digitalmars.D.bugs - [Issue 21688] New: CTFE has floats and doubles that exceed float.max
- d-bugmail puremagic.com (34/34) Mar 08 2021 https://issues.dlang.org/show_bug.cgi?id=21688
https://issues.dlang.org/show_bug.cgi?id=21688 Issue ID: 21688 Summary: CTFE has floats and doubles that exceed float.max and double.max Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla bernis-buecher.de With x87 reals available, this unittest passes, although it shouldn't: ``` float f(float a) { return 100*a; } unittest { enum f1 = float.max; pragma(msg, f(f1)); // 3.40282e+40F (>float.max) pragma(msg, typeof(f(f1)).stringof); // float // at least one of these three asserts should fail, // IMHO the last one static assert(is (typeof(f(f1)) == float)); static assert(f(f1) > float.max); static assert(f(f1) != float.infinity); } ``` The same is true for doubles. --
Mar 08 2021