about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/s_cbrt.c6
-rw-r--r--sysdeps/libm-ieee754/s_cbrtf.c6
-rw-r--r--sysdeps/libm-ieee754/s_cbrtl.c6
3 files changed, 12 insertions, 6 deletions
diff --git a/sysdeps/libm-ieee754/s_cbrt.c b/sysdeps/libm-ieee754/s_cbrt.c
index a5033ff468..753049d375 100644
--- a/sysdeps/libm-ieee754/s_cbrt.c
+++ b/sysdeps/libm-ieee754/s_cbrt.c
@@ -46,8 +46,10 @@ __cbrt (double x)
   xm = __frexp (fabs (x), &xe);
 
   /* If X is not finite or is null return it (with raising exceptions
-     if necessary.  */
-  if (xe == 0)
+     if necessary.
+     Note: *Our* version of `frexp' sets XE to zero if the argument is
+     Inf or NaN.  This is not portable but faster.  */
+  if (xe == 0 && fpclassify (x) <= FP_ZERO)
     return x + x;
 
  u = (0.354895765043919860
diff --git a/sysdeps/libm-ieee754/s_cbrtf.c b/sysdeps/libm-ieee754/s_cbrtf.c
index f9f687c011..fa0fef9987 100644
--- a/sysdeps/libm-ieee754/s_cbrtf.c
+++ b/sysdeps/libm-ieee754/s_cbrtf.c
@@ -46,8 +46,10 @@ __cbrtf (float x)
   xm = __frexpf (fabsf (x), &xe);
 
   /* If X is not finite or is null return it (with raising exceptions
-     if necessary.  */
-  if (xe == 0)
+     if necessary.
+     Note: *Our* version of `frexp' sets XE to zero if the argument is
+     Inf or NaN.  This is not portable but faster.  */
+  if (xe == 0 && fpclassify (x) <= FP_ZERO)
     return x + x;
 
   u = (0.492659620528969547 + (0.697570460207922770
diff --git a/sysdeps/libm-ieee754/s_cbrtl.c b/sysdeps/libm-ieee754/s_cbrtl.c
index b3a53a39e1..1d021b7c3c 100644
--- a/sysdeps/libm-ieee754/s_cbrtl.c
+++ b/sysdeps/libm-ieee754/s_cbrtl.c
@@ -48,8 +48,10 @@ __cbrtl (long double x)
   xm = __frexpl (fabs (x), &xe);
 
   /* If X is not finite or is null return it (with raising exceptions
-     if necessary.  */
-  if (xe == 0)
+     if necessary.
+     Note: *Our* version of `frexp' sets XE to zero if the argument is
+     Inf or NaN.  This is not portable but faster.  */
+  if (xe == 0 && fpclassify (x) <= FP_ZERO)
     return x + x;
 
   u = (0.338058687610520237