www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17662] New: Replace 2.0^e2 with std.math.ldexp(1.0, cast(int)

https://issues.dlang.org/show_bug.cgi?id=17662

          Issue ID: 17662
           Summary: Replace 2.0^e2 with std.math.ldexp(1.0, cast(int) e2)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

See also: https://github.com/dlang/phobos/pull/5057

 It should be clear that just setting the exponent (some integer ops) is way
faster than the current loop for bigger absolute N, but I didn't perform any
speed tests.
I'd rather drop this and add the optimization to the compiler, something like [1] [1] https://github.com/kinke/ldc/commit/dc01a338d73c2cdb843de6426f520f6c175640d3 --
Jul 17 2017