ldc
ldc copied to clipboard
`to!double("0.1") != to!double("0.1000000000000000")` on Windows
trafficstars
This program should print 0:
import std.conv;
import std.stdio;
void main()
{
auto a = to!double("0.1");
auto b = to!double("0.1000000000000000");
writeln(a - b);
}
On Windows, this prints 1.38778e-17.
- Happens with either
-m32mscoffand-m64. - Doesn't happen with
dmd(either-m32mscoffor-m64). - I can reproduce this in Wine too.
Related (or same?) issue: https://github.com/ldc-developers/ldc/issues/4433