Thread overview
[Issue 7691] std.math.floor at compile-time too
[Issue 7691] A pure std.math.floor
Jan 27, 2015
AndyC
Oct 16, 2018
Nathan S.
January 27, 2015
https://issues.dlang.org/show_bug.cgi?id=7691

AndyC <andy@squeakycode.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andy@squeakycode.net

--- Comment #5 from AndyC <andy@squeakycode.net> ---
In dmd 2.066.1, I get:
$ dmd test.d
/usr/include/dmd/phobos/std/math.d(4183): Error: Cannot convert &double to
ulong* at compile time
/usr/include/dmd/phobos/std/math.d(3288):        called from here: isNaN(x)
test.d(4):        called from here: floor(2.3)


Any reason it has to be enum?  Changing it to either const or immutable compiles fine:

pure void main() {
    const double x = floor(2.3);
}

--
January 27, 2015
https://issues.dlang.org/show_bug.cgi?id=7691

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|A pure std.math.floor       |std.math.floor at
                   |                            |compile-time too

--- Comment #6 from bearophile_hugs@eml.cc ---
(In reply to AndyC from comment #5)

> Any reason it has to be enum?

D needs to support basic operations like floor() at compile time too. I change the title of his issue.

--
October 16, 2018
https://issues.dlang.org/show_bug.cgi?id=7691

Nathan S. <n8sh.secondary@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |n8sh.secondary@hotmail.com
         Resolution|---                         |FIXED

--- Comment #7 from Nathan S. <n8sh.secondary@hotmail.com> ---
std.math.floor is `pure` as of https://github.com/dlang/phobos/pull/1426 and currently works in CTFE.

--