diff options
author | Szabolcs Nagy <nsz@port70.net> | 2024-03-14 00:57:15 +0100 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2024-03-14 10:04:42 -0400 |
commit | 9683bd62414604d3bd56cf6bd7be8f54aa31e7d3 (patch) | |
tree | fec3dbd3d660a979d52132d6e8bab526432b09ea /src | |
parent | 5370070fded61b569196764673a4fc8440aac79e (diff) | |
download | musl-9683bd62414604d3bd56cf6bd7be8f54aa31e7d3.zip musl-9683bd62414604d3bd56cf6bd7be8f54aa31e7d3.tar.gz musl-9683bd62414604d3bd56cf6bd7be8f54aa31e7d3.tar.bz2 |
math: fix fma(x,y,0) when x*y rounds to -0
if x!=0, y!=0, z==0 then
fma(x,y,z) == x*y
in all rounding modes, while adding z can ruin the sign of 0 if x*y
rounds to -0.
Diffstat (limited to 'src')
-rw-r--r-- | src/math/fma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/fma.c b/src/math/fma.c index 0c6f90c..adfadca 100644 --- a/src/math/fma.c +++ b/src/math/fma.c @@ -53,7 +53,7 @@ double fma(double x, double y, double z) return x*y + z; if (nz.e >= ZEROINFNAN) { if (nz.e > ZEROINFNAN) /* z==0 */ - return x*y + z; + return x*y; return z; } |