April 24, 2023 [Issue 23856] New: The problem of accuracy loss in double division | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23856 Issue ID: 23856 Summary: The problem of accuracy loss in double division Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: mzfhhhh@foxmail.com import std; void main() { double v = 0.0025; ulong a = cast(ulong)((cast(double) 50) / v); double t = (cast(double) 50) / v; ulong b = cast(ulong)(t); ulong c = cast(ulong)((cast(double) 50) / cast(double)0.0025); // dmd 2.103.0 a = 19999 , accuracy loss // ldc 1.32.0 a = 20000 info(a); // b= 20000 info(b); // c= 20000 info(c); } -- |
Copyright © 1999-2021 by the D Language Foundation