Thread overview | |||||
---|---|---|---|---|---|
|
June 21, 2022 [Issue 23200] sqrt cast to long and ulong differ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23200 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl --- Comment #1 from Dennis <dkorpel@live.nl> --- Removing the Phobos dependency: ``` static import core.math; pragma(inline, true) double sqrt(double x) @nogc @safe pure nothrow { return core.math.sqrt(x); } extern(C) void main() { double d = 9007199515875288.; auto r1 = cast (ulong) sqrt(d); auto r2 = cast (long) sqrt(d); assert (r1 == r2); } ``` It doesn't happen when calling core.math.sqrt directly, it looks like the problem manifests because of the inliner: ``` // output of -vcg-ast extern (C) extern (C) void main() { double d = 9.0072e+15; ulong r1 = cast(ulong)((double x = d;) , sqrt(x)); long r2 = cast(long)((double x = d;) , sqrt(x)); assert(r1 == cast(ulong)r2); return 0; } ``` It casts the comma expression to long/ulong, which may trip up the code generator. -- |
December 17, 2022 [Issue 23200] sqrt cast to long and ulong differ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23200 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 23200] sqrt cast to long and ulong differ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23200 --- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20122 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation