ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.21k stars 261 forks source link

`to!double("0.1") != to!double("0.1000000000000000")` on Windows #4449

Open CyberShadow opened 1 year ago

CyberShadow commented 1 year ago

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.

JohanEngelen commented 1 year ago

Related (or same?) issue: https://github.com/ldc-developers/ldc/issues/4433