[Issue 21376] New: [x86-only] Returning 32-bit floats have wrong precision
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 10 18:03:36 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21376
Issue ID: 21376
Summary: [x86-only] Returning 32-bit floats have wrong
precision
Product: D
Version: D2
Hardware: x86
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Reduced testcase, blocking this PR: https://github.com/dlang/phobos/pull/7669
On x86_64, `log` is given 1.0, but on x86, the value is
0.99999998653882640021551067577298966.
---
import core.math;
real hypot(real x, real y)
{
real u = fabs(x);
real v = fabs(y);
return sqrt(u*u + v*v);
}
float abs(float re, float im)
{
return hypot(re, im);
}
void log(real x)
{
assert(x == 1);
}
extern(C) void main()
{
float re = 0.866025403784438646787;
float im = 0.5;
return log(abs(re, im));
}
--
More information about the Digitalmars-d-bugs
mailing list