X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Ffmal.c;h=be64f145bbaeee42d5f29b63ce87f31251c15942;hb=769d3d349824fb45218972a1cf0e912cfee62d51;hp=3944c29298e108c861d1c0f6aee9a7fe6264ebdc;hpb=2e77dc13f8bc2053642fcb136996f5f36c88c775;p=musl diff --git a/src/math/fmal.c b/src/math/fmal.c index 3944c292..be64f145 100644 --- a/src/math/fmal.c +++ b/src/math/fmal.c @@ -115,7 +115,7 @@ static inline long double add_and_denormalize(long double a, long double b, int if (bits_lost != 1 ^ (int)(u.bits.manl & 1)) sum.hi = nextafterl(sum.hi, INFINITY * sum.lo); } - return (ldexp(sum.hi, scale)); + return scalbnl(sum.hi, scale); } /* @@ -173,14 +173,14 @@ long double fmal(long double x, long double y, long double z) * return values here are crucial in handling special cases involving * infinities, NaNs, overflows, and signed zeroes correctly. */ - if (x == 0.0 || y == 0.0) - return (x * y + z); - if (z == 0.0) - return (x * y); if (!isfinite(x) || !isfinite(y)) return (x * y + z); if (!isfinite(z)) return (z); + if (x == 0.0 || y == 0.0) + return (x * y + z); + if (z == 0.0) + return (x * y); xs = frexpl(x, &ex); ys = frexpl(y, &ey); @@ -228,7 +228,7 @@ long double fmal(long double x, long double y, long double z) } } if (spread <= LDBL_MANT_DIG * 2) - zs = ldexpl(zs, -spread); + zs = scalbnl(zs, -spread); else zs = copysignl(LDBL_MIN, zs); @@ -254,7 +254,7 @@ long double 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)); + return xy.hi + vzs + scalbnl(xy.lo, spread); } if (oround != FE_TONEAREST) { @@ -264,13 +264,13 @@ long double fmal(long double x, long double y, long double z) */ fesetround(oround); adj = r.lo + xy.lo; - return (ldexpl(r.hi + adj, spread)); + return scalbnl(r.hi + adj, spread); } adj = add_adjusted(r.lo, xy.lo); if (spread + ilogbl(r.hi) > -16383) - return (ldexpl(r.hi + adj, spread)); + return scalbnl(r.hi + adj, spread); else - return (add_and_denormalize(r.hi, adj, spread)); + return add_and_denormalize(r.hi, adj, spread); } #endif