summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2024-03-14 00:57:15 +0100
committerRich Felker <dalias@aerifal.cx>2024-03-14 10:04:42 -0400
commit9683bd62414604d3bd56cf6bd7be8f54aa31e7d3 (patch)
treefec3dbd3d660a979d52132d6e8bab526432b09ea /src
parent5370070fded61b569196764673a4fc8440aac79e (diff)
downloadmusl-9683bd62414604d3bd56cf6bd7be8f54aa31e7d3.tar.gz
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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/math/fma.c b/src/math/fma.c
index 0c6f90c9..adfadca8 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;
}