Floating point constant folding bug?

Johannes Pfau nospam at example.com
Fri Mar 15 08:15:32 PDT 2013


writefln("%f\n%f", cast(float)cast(int)float.infinity, float.infinity);

writes
---
2147483648.000000
inf
---

-fdump-tree-original
---
writefln ({.length=5, .ptr="%f\n%f"}, 2.147483647e+9,  Inf);
---

The same conversion at runtime produces the expected result.

Is this a gdc or gcc bug or is this expected?


More information about the D.gnu mailing list