aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/power5+/fpu/s_modff.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-03-08 11:24:32 -0600
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-03-08 11:24:32 -0600
commit54b46a4b3efd179ccbbf8e342e64391e2b590f1b (patch)
tree32dfb4e2743b612727fbf3ca05bacdfe9e103bba /sysdeps/powerpc/power5+/fpu/s_modff.c
parente9996ef750d845b46bc7d743c730c73f044720af (diff)
downloadglibc-54b46a4b3efd179ccbbf8e342e64391e2b590f1b.tar
glibc-54b46a4b3efd179ccbbf8e342e64391e2b590f1b.tar.gz
glibc-54b46a4b3efd179ccbbf8e342e64391e2b590f1b.tar.bz2
glibc-54b46a4b3efd179ccbbf8e342e64391e2b590f1b.zip
PowerPC: Fix modf/modff optimization return sign
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.
Diffstat (limited to 'sysdeps/powerpc/power5+/fpu/s_modff.c')
-rw-r--r--sysdeps/powerpc/power5+/fpu/s_modff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/powerpc/power5+/fpu/s_modff.c b/sysdeps/powerpc/power5+/fpu/s_modff.c
index e4fe857d29..af17becf13 100644
--- a/sysdeps/powerpc/power5+/fpu/s_modff.c
+++ b/sysdeps/powerpc/power5+/fpu/s_modff.c
@@ -35,12 +35,12 @@ __modff (float x, float *iptr)
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)