This patch fix the optimized powerpc-fpu modf/modff implementation
when using in non-default rounding mode where the zero sign is not
as expected. It fixes the libm testsuite tests
modf_downward (0) == 0.
00000000000000000000e+00
modf_downward (20) == 0.
00000000000000000000e+00
modf_downward (21) == 0.
00000000000000000000e+00
Where the sign returned was negative.
+2014-03-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/power5+/fpu/s_modf.c (__modf): Fix to return correct
+ sign in non default rounding modes.
+ * sysdeps/powerpc/power5+/fpu/s_modff.c (__modff): Likewise.
+
2014-03-08 Joseph Myers <joseph@codesourcery.com>
* math/libm-test.inc (ALL_RM_TEST): New macro.
if (x >= 0.0)
{
*iptr = __floor (x);
- return (x - *iptr);
+ return __copysign (x - *iptr, x);
}
else
{
*iptr = __ceil (x);
- return (x - *iptr);
+ return __copysign (x - *iptr, x);
}
}
weak_alias (__modf, modf)
if (x >= 0.0)
{
*iptr = __floorf (x);
- return (x - *iptr);
+ return __copysignf (x - *iptr, x);
}
else
{
*iptr = __ceilf (x);
- return (x - *iptr);
+ return __copysignf (x - *iptr, x);
}
}
weak_alias (__modff, modff)