Bug 17705 – std.math.isFinite cannot run at compile-time

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-31T05:38:01Z
Last change time
2020-03-21T03:56:34Z
Keywords
pull
Assigned to
No Owner
Creator
Infiltrator
Blocks
17007

Comments

Comment #0 by lt.infiltrator — 2017-07-31T05:38:01Z
---- import std.math : isFinite; enum test = isFinite(15.0); ---- From what I understand from ketmar, the issue is that the CTFE allows casting of floating types only to the same size, but isFinite casts it to ushort. This can be solved for float and double by using uint and ulong, respectively; but I do not know how to make it work real, unless we allow casting to a struct/array.
Comment #1 by lt.infiltrator — 2017-07-31T05:46:15Z
---- /opt/compilers/dmd2/include/std/math.d(5385): Error: cannot convert &double to ushort* at compile time /d948/f137.d(2): called from here: isFinite(15.0000) ----
Comment #2 by n8sh.secondary — 2019-09-04T19:31:01Z
Verified this as not working. Re-opening.
Comment #3 by dlang-bot — 2019-09-04T19:33:01Z
@n8sh created dlang/phobos pull request #7169 "Fix Issue 17705 - std.math.isFinite cannot run at compile-time" fixing this issue: - Fix Issue 17705 - std.math.isFinite cannot run at compile-time https://github.com/dlang/phobos/pull/7169
Comment #4 by dlang-bot — 2019-09-05T05:44:28Z
dlang/phobos pull request #7169 "Fix Issue 17705 - std.math.isFinite cannot run at compile-time" was merged into master: - a26d88c16f30181a88bda8020865439b6dead9be by Nathan Sashihara: Fix Issue 17705 - std.math.isFinite cannot run at compile-time https://github.com/dlang/phobos/pull/7169