libm: fma: correct zero sign with small inputs

PR:		277783
Reported by:	Victor Stinner
Submitted by:	kargl
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D44433
This commit is contained in:
Ed Maste 2024-03-19 10:31:39 -04:00
parent 5ee5c40402
commit 888796ade2
2 changed files with 6 additions and 2 deletions

View file

@ -267,7 +267,9 @@ fma(double x, double y, double z)
*/
fesetround(oround);
volatile double vzs = zs; /* XXX gcc CSE bug workaround */
return (xy.hi + vzs + ldexp(xy.lo, spread));
xs = ldexp(xy.lo, spread);
xy.hi += vzs;
return (xy.hi == 0 ? xs : xy.hi + xs);
}
if (oround != FE_TONEAREST) {

View file

@ -248,7 +248,9 @@ fmal(long double x, long double y, long double z)
*/
fesetround(oround);
volatile long double vzs = zs; /* XXX gcc CSE bug workaround */
return (xy.hi + vzs + ldexpl(xy.lo, spread));
xs = ldexpl(xy.lo, spread);
xy.hi += vzs;
return (xy.hi == 0 ? xs : xy.hi + xs);
}
if (oround != FE_TONEAREST) {