phobos
phobos copied to clipboard
Decimal string parsing isn't IEEE compatible
ilyayaroshenko reported this on 2020-06-21T13:57:02Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=20967
CC List
- bugzilla (@WalterBright)
Description
import std.conv;
void main() {
assert("1.448997445238699".to!double == 0x1.72f17f1f49aadp0);
}
bugzilla (@WalterBright) commented on 2021-03-25T06:32:23Z
Verified this. Left side produces 0x1.72f17f1f49aaep0 but right side is the correct value.
Working on it
Catch by mojo:
{
ulong msdec = 1448997445238699;
printf("%a\n", cast(double)(msdec / 1e15)); // 0x1.72f17f1f49aadp+0
}
but
{
printf("%a\n", cast(double)(1448997445238699UL / 1e15)); // 0x1.72f17f1f49aaep+0
}