[Issue 20278] ICE: calling std.math.sqrt with int cast to double

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 7 18:53:59 UTC 2019


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

--- Comment #6 from hsteoh at quickfur.ath.cx ---
Writing the return statement as:
------
return sqrt(cast(double)(x*x + y));
------

makes the problem go away. Parenthesizing (x*x) also makes the problem go away.
Somehow something goes wrong when the cast operator is applied only to the
first element of the product x*x.  The +y appears to be necessary, since
removing that also makes the error go away.

--


More information about the Digitalmars-d-bugs mailing list