digitalmars.D.bugs - [Issue 23200] New: sqrt cast to long and ulong differ
- d-bugmail puremagic.com (35/35) Jun 20 2022 https://issues.dlang.org/show_bug.cgi?id=23200
https://issues.dlang.org/show_bug.cgi?id=23200 Issue ID: 23200 Summary: sqrt cast to long and ulong differ Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: kdevel vogtner.de unittest { import std.math; double d = 9007199515875288.; auto r1 = cast (ulong) sqrt (d); auto r2 = cast (long) sqrt (d); assert (r1 == r2); } $ dmd -checkaction=context -unittest -main -run sub.d sub.d(6): [unittest] 94906266 != 94906267 1/1 modules FAILED unittests The expected value is 94906267: $ bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. scale=17 sqrt(9007199515875288) 94906266.99999999473164401 For ASM code generated cf. http://forum.dlang.org/post/qsjkksrkosylhqsohbvk forum.dlang.org --
Jun 20 2022