This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix math functions triggering invalid exceptions


Commits bcf01e6d and 0ac5ae23 optimized math functions by, among other
things, removing the special cases for NaN, and letting them propagate
through the whole code. The idea seems good, given that NaN should be
considered as the exception rather than the rule, but the floating point
comparison operators in C are signaling operations. Thus on 
architectures using the changed code, an invalid exception is triggered
when a mathematical function is passed a NaN. This violates the C
specification.

As a consequence, test-float, test-ifloat, test-double and test-idouble
are failing on at least arm, mips, ia64 and sparc. Architectures like
x86, x86-64 or s390 are not affected given they have their own
implementation of most floating point functions.

The patch below addresses the issue by using non-signaling
floating-point comparisons, that is functions like isgreater, isless or
isgreaterequal.


2012-02-15  Aurelien Jarno  <aurelien@aurel32.net>

	* math/w_acos.c: Use non-signaling floating-point comparisons.
	* math/w_acosf.c: Likewise.
	* math/w_acosh.c: Likewise.
	* math/w_acoshf.c: Likewise.
	* math/w_acoshl.c: Likewise.
	* math/w_acosl.c: Likewise.
	* math/w_asin.c: Likewise.
	* math/w_asinf.c: Likewise.
	* math/w_asinl.c: Likewise.
	* math/w_atanh.c: Likewise.
	* math/w_atanhf.c: Likewise.
	* math/w_atanhl.c: Likewise.
	* math/w_exp2.c: Likewise.
	* math/w_exp2f.c: Likewise.
	* math/w_exp2l.c: Likewise.
	* math/w_j0.c: Likewise.
	* math/w_j0f.c: Likewise.
	* math/w_j0l.c: Likewise.
	* math/w_j1.c: Likewise.
	* math/w_j1f.c: Likewise.
	* math/w_j1l.c: Likewise.
	* math/w_jn.c: Likewise.
	* math/w_jnf.c: Likewise.
	* math/w_log.c: Likewise.
	* math/w_log10.c: Likewise.
	* math/w_log10f.c: Likewise.
	* math/w_log10l.c: Likewise.
	* math/w_log2.c: Likewise.
	* math/w_log2f.c: Likewise.
	* math/w_log2l.c: Likewise.
	* math/w_logf.c: Likewise.
	* math/w_logl.c: Likewise.
	* math/w_sqrt.c: Likewise.
	* math/w_sqrtf.c: Likewise.
	* math/w_sqrtl.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atanh.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp.c: Likewise.
	* sysdeps/ieee754/flt-32/e_atanhf.c: Likewise.
	* sysdeps/ieee754/flt-32/w_expf.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl.c: Likewise.

---
 math/w_acos.c                     |    3 ++-
 math/w_acosf.c                    |    3 ++-
 math/w_acosh.c                    |    2 +-
 math/w_acoshf.c                   |    2 +-
 math/w_acoshl.c                   |    2 +-
 math/w_acosl.c                    |    3 ++-
 math/w_asin.c                     |    3 ++-
 math/w_asinf.c                    |    3 ++-
 math/w_asinl.c                    |    3 ++-
 math/w_atanh.c                    |    3 ++-
 math/w_atanhf.c                   |    3 ++-
 math/w_atanhl.c                   |    3 ++-
 math/w_exp2.c                     |    3 ++-
 math/w_exp2f.c                    |    3 ++-
 math/w_exp2l.c                    |    3 ++-
 math/w_j0.c                       |    6 ++++--
 math/w_j0f.c                      |    5 +++--
 math/w_j0l.c                      |    6 ++++--
 math/w_j1.c                       |    6 ++++--
 math/w_j1f.c                      |    6 ++++--
 math/w_j1l.c                      |    6 ++++--
 math/w_jn.c                       |    6 ++++--
 math/w_jnf.c                      |    5 +++--
 math/w_log.c                      |    2 +-
 math/w_log10.c                    |    2 +-
 math/w_log10f.c                   |    2 +-
 math/w_log10l.c                   |    2 +-
 math/w_log2.c                     |    2 +-
 math/w_log2f.c                    |    2 +-
 math/w_log2l.c                    |    2 +-
 math/w_logf.c                     |    2 +-
 math/w_logl.c                     |    2 +-
 math/w_sqrt.c                     |    2 +-
 math/w_sqrtf.c                    |    2 +-
 math/w_sqrtl.c                    |    2 +-
 sysdeps/ieee754/dbl-64/e_atanh.c  |    6 +++---
 sysdeps/ieee754/dbl-64/w_exp.c    |    4 ++--
 sysdeps/ieee754/flt-32/e_atanhf.c |    6 +++---
 sysdeps/ieee754/flt-32/w_expf.c   |    4 ++--
 sysdeps/ieee754/ldbl-96/w_expl.c  |    4 ++--
 40 files changed, 81 insertions(+), 55 deletions(-)

--- a/math/w_acos.c
+++ b/math/w_acos.c
@@ -26,7 +26,8 @@
 double
 __acos (double x)
 {
-  if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabs (x), 1.0), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* acos(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_acosf.c
+++ b/math/w_acosf.c
@@ -26,7 +26,8 @@
 float
 __acosf (float x)
 {
-  if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsf (x), 1.0f), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* acos(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_acosh.c
+++ b/math/w_acosh.c
@@ -25,7 +25,7 @@
 double
 __acosh (double x)
 {
-  if (__builtin_expect (x < 1.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x,  1.0), 0) && _LIB_VERSION != _IEEE_)
     /* acosh(x<1) */
     return __kernel_standard (x, x, 29);
 
--- a/math/w_acoshf.c
+++ b/math/w_acoshf.c
@@ -25,7 +25,7 @@
 float
 __acoshf (float x)
 {
-  if (__builtin_expect (x < 1.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x, 1.0f), 0) && _LIB_VERSION != _IEEE_)
     /* acosh(x<1) */
     return __kernel_standard_f (x, x, 129);
 
--- a/math/w_acoshl.c
+++ b/math/w_acoshl.c
@@ -25,7 +25,7 @@
 long double
 __acoshl (long double x)
 {
-  if (__builtin_expect (x < 1.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x, 1.0L), 0) && _LIB_VERSION != _IEEE_)
     /* acosh(x<1) */
     return __kernel_standard (x, x, 229);
 
--- a/math/w_acosl.c
+++ b/math/w_acosl.c
@@ -26,7 +26,8 @@
 long double
 __acosl (long double x)
 {
-  if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsl (x), 1.0L), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* acos(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_asin.c
+++ b/math/w_asin.c
@@ -26,7 +26,8 @@
 double
 __asin (double x)
 {
-  if (__builtin_expect (fabs (x) > 1.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabs (x),  1.0), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* asin(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_asinf.c
+++ b/math/w_asinf.c
@@ -26,7 +26,8 @@
 float
 __asinf (float x)
 {
-  if (__builtin_expect (fabsf (x) > 1.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsf (x), 1.0f), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* asin(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_asinl.c
+++ b/math/w_asinl.c
@@ -26,7 +26,8 @@
 long double
 __asinl (long double x)
 {
-  if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsl (x), 1.0L), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       /* asin(|x|>1) */
       feraiseexcept (FE_INVALID);
--- a/math/w_atanh.c
+++ b/math/w_atanh.c
@@ -25,7 +25,8 @@
 double
 __atanh (double x)
 {
-  if (__builtin_expect (fabs (x) >= 1.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreaterequal (fabs (x), 1.0), 0)
+      && _LIB_VERSION != _IEEE_)
     return __kernel_standard (x, x,
 			      fabs (x) > 1.0
 			      ? 30		/* atanh(|x|>1) */
--- a/math/w_atanhf.c
+++ b/math/w_atanhf.c
@@ -25,7 +25,8 @@
 float
 __atanhf (float x)
 {
-  if (__builtin_expect (fabsf (x) >= 1.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreaterequal (fabsf (x), 1.0f), 0)
+      && _LIB_VERSION != _IEEE_)
     return __kernel_standard_f (x, x,
 				fabsf (x) > 1.0f
 				? 130		/* atanh(|x|>1) */
--- a/math/w_atanhl.c
+++ b/math/w_atanhl.c
@@ -25,7 +25,8 @@
 long double
 __atanhl (long double x)
 {
-  if (__builtin_expect (fabsl (x) >= 1.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreaterequal (fabsl (x), 1.0L), 0)
+      && _LIB_VERSION != _IEEE_)
     return __kernel_standard (x, x,
 			      fabsl (x) > 1.0L
 			      ? 230		/* atanh(|x|>1) */
--- a/math/w_exp2.c
+++ b/math/w_exp2.c
@@ -12,7 +12,8 @@
 double
 __exp2 (double x)
 {
-  if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+  if (__builtin_expect (islessequal (x, u_threshold)
+			|| isgreater (x, o_threshold), 0)
       && _LIB_VERSION != _IEEE_ && __finite (x))
     /* exp2 overflow: 44, exp2 underflow: 45 */
     return __kernel_standard (x, x, 44 + (x <= o_threshold));
--- a/math/w_exp2f.c
+++ b/math/w_exp2f.c
@@ -12,7 +12,8 @@
 float
 __exp2f (float x)
 {
-  if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+  if (__builtin_expect (islessequal(x, u_threshold)
+			|| isgreater(x, o_threshold), 0)
       && _LIB_VERSION != _IEEE_ && __finitef (x))
     /* exp2 overflow: 144, exp2 underflow: 145 */
     return __kernel_standard_f (x, x, 144 + (x <= o_threshold));
--- a/math/w_exp2l.c
+++ b/math/w_exp2l.c
@@ -13,7 +13,8 @@
 long double
 __exp2l (long double x)
 {
-  if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
+  if (__builtin_expect (islessequal (x, u_threshold)
+			|| isgreater(x, o_threshold), 0)
       && _LIB_VERSION != _IEEE_ && __finitel (x))
     /* exp2 overflow: 244, exp2 underflow: 245 */
     return __kernel_standard (x, x, 244 + (x <= o_threshold));
--- a/math/w_j0.c
+++ b/math/w_j0.c
@@ -26,7 +26,8 @@
 double
 j0 (double x)
 {
-  if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* j0(|x|>X_TLOSS) */
     return __kernel_standard (x, x, 34);
 
@@ -41,7 +42,8 @@
 double
 y0 (double x)
 {
-  if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0) || isgreater (x, X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0)
 	{
--- a/math/w_j0f.c
+++ b/math/w_j0f.c
@@ -26,7 +26,7 @@
 float
 j0f (float x)
 {
-  if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+  if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
       && _LIB_VERSION != _IEEE_)
     /* j0(|x|>X_TLOSS) */
     return __kernel_standard_f (x, x, 134);
@@ -39,7 +39,8 @@
 float
 y0f (float x)
 {
-  if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+  if (__builtin_expect (islessequal (x, 0.0f)
+                        || isgreater (x, (float) X_TLOSS), 0)
       && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0f)
--- a/math/w_j0l.c
+++ b/math/w_j0l.c
@@ -26,7 +26,8 @@
 long double
 __j0l (long double x)
 {
-  if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* j0(|x|>X_TLOSS) */
     return __kernel_standard (x, x, 234);
 
@@ -39,7 +40,8 @@
 long double
 __y0l (long double x)
 {
-  if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0L) || isgreater(x, X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0L)
 	{
--- a/math/w_j1.c
+++ b/math/w_j1.c
@@ -26,7 +26,8 @@
 double
 j1 (double x)
 {
-  if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* j1(|x|>X_TLOSS) */
     return __kernel_standard (x, x, 36);
 
@@ -41,7 +42,8 @@
 double
 y1 (double x)
 {
-  if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal(x, 0.0) || isgreater (x, X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0)
 	{
--- a/math/w_j1f.c
+++ b/math/w_j1f.c
@@ -26,7 +26,8 @@
 float
 j1f (float x)
 {
-  if (__builtin_expect (fabsf (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsf (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* j1(|x|>X_TLOSS) */
     return __kernel_standard_f (x, x, 136);
 
@@ -38,7 +39,8 @@
 float
 y1f (float x)
 {
-  if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+  if (__builtin_expect (islessequal(x, 0.0f)
+			|| isgreater (x, (float) X_TLOSS), 0)
       && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0f)
--- a/math/w_j1l.c
+++ b/math/w_j1l.c
@@ -26,7 +26,8 @@
 long double
 __j1l (long double x)
 {
-  if (__builtin_expect (fabsl (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabsl (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* j1(|x|>X_TLOSS) */
     return __kernel_standard (x, x, 236);
 
@@ -39,7 +40,8 @@
 long double
 __y1l (long double x)
 {
-  if (__builtin_expect (x <= 0.0L || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal(x, 0.0L) || isgreater (x, X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0L)
 	{
--- a/math/w_jn.c
+++ b/math/w_jn.c
@@ -26,7 +26,8 @@
 double
 jn (int n, double x)
 {
-  if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isgreater (fabs (x), X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     /* jn(n,|x|>X_TLOSS) */
     return __kernel_standard (n, x, 38);
 
@@ -41,7 +42,8 @@
 double
 yn (int n, double x)
 {
-  if (__builtin_expect (x <= 0.0 || x > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal(x, 0.0) || isgreater (x, X_TLOSS), 0)
+      && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0)
 	{
--- a/math/w_jnf.c
+++ b/math/w_jnf.c
@@ -26,7 +26,7 @@
 float
 jnf (int n, float x)
 {
-  if (__builtin_expect (fabsf (x) > (float) X_TLOSS, 0)
+  if (__builtin_expect (isgreater (fabsf (x), (float) X_TLOSS), 0)
       && _LIB_VERSION != _IEEE_)
     /* jn(n,|x|>X_TLOSS) */
     return __kernel_standard_f (n, x, 138);
@@ -39,7 +39,8 @@
 float
 ynf (int n, float x)
 {
-  if (__builtin_expect (x <= 0.0f || x > (float) X_TLOSS, 0)
+  if (__builtin_expect (islessequal(x, 0.0f)
+			|| isgreater (x, (float) X_TLOSS), 0)
       && _LIB_VERSION != _IEEE_)
     {
       if (x < 0.0f)
--- a/math/w_log.c
+++ b/math/w_log.c
@@ -26,7 +26,7 @@
 double
 __log (double x)
 {
-  if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0)
 	{
--- a/math/w_log10.c
+++ b/math/w_log10.c
@@ -26,7 +26,7 @@
 double
 __log10 (double x)
 {
-  if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0)
 	{
--- a/math/w_log10f.c
+++ b/math/w_log10f.c
@@ -26,7 +26,7 @@
 float
 __log10f (float x)
 {
-  if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0f), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0f)
 	{
--- a/math/w_log10l.c
+++ b/math/w_log10l.c
@@ -26,7 +26,7 @@
 long double
 __log10l (long double x)
 {
-  if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0L), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0L)
 	{
--- a/math/w_log2.c
+++ b/math/w_log2.c
@@ -26,7 +26,7 @@
 double
 __log2 (double x)
 {
-  if (__builtin_expect (x <= 0.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0)
 	{
--- a/math/w_log2f.c
+++ b/math/w_log2f.c
@@ -26,7 +26,7 @@
 float
 __log2f (float x)
 {
-  if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0f), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0)
 	{
--- a/math/w_log2l.c
+++ b/math/w_log2l.c
@@ -26,7 +26,7 @@
 long double
 __log2l (long double x)
 {
-  if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0L), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0L)
 	{
--- a/math/w_logf.c
+++ b/math/w_logf.c
@@ -26,7 +26,7 @@
 float
 __logf (float x)
 {
-  if (__builtin_expect (x <= 0.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0f), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0f)
 	{
--- a/math/w_logl.c
+++ b/math/w_logl.c
@@ -26,7 +26,7 @@
 long double
 __logl (long double x)
 {
-  if (__builtin_expect (x <= 0.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (islessequal (x, 0.0L), 0) && _LIB_VERSION != _IEEE_)
     {
       if (x == 0.0L)
 	{
--- a/math/w_sqrt.c
+++ b/math/w_sqrt.c
@@ -25,7 +25,7 @@
 double
 __sqrt (double x)
 {
-  if (__builtin_expect (x < 0.0, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x, 0.0), 0) && _LIB_VERSION != _IEEE_)
     return __kernel_standard (x, x, 26); /* sqrt(negative) */
 
   return __ieee754_sqrt (x);
--- a/math/w_sqrtf.c
+++ b/math/w_sqrtf.c
@@ -25,7 +25,7 @@
 float
 __sqrtf (float x)
 {
-  if (__builtin_expect (x < 0.0f, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x, 0.0f), 0) && _LIB_VERSION != _IEEE_)
     return __kernel_standard_f (x, x, 126); /* sqrt(negative) */
 
   return __ieee754_sqrtf (x);
--- a/math/w_sqrtl.c
+++ b/math/w_sqrtl.c
@@ -25,7 +25,7 @@
 long double
 __sqrtl (long double x)
 {
-  if (__builtin_expect (x < 0.0L, 0) && _LIB_VERSION != _IEEE_)
+  if (__builtin_expect (isless (x, 0.0L), 0) && _LIB_VERSION != _IEEE_)
     return __kernel_standard (x, x, 226); /* sqrt(negative) */
 
   return __ieee754_sqrtl (x);
--- a/sysdeps/ieee754/dbl-64/e_atanh.c
+++ b/sysdeps/ieee754/dbl-64/e_atanh.c
@@ -47,7 +47,7 @@
 {
   double xa = fabs (x);
   double t;
-  if (xa < 0.5)
+  if (isless(xa, 0.5))
     {
       if (__builtin_expect (xa < 0x1.0p-28, 0))
 	{
@@ -58,11 +58,11 @@
       t = xa + xa;
       t = 0.5 * __log1p (t + t * xa / (1.0 - xa));
     }
-  else if (__builtin_expect (xa < 1.0, 1))
+  else if (__builtin_expect (isless(xa, 1.0), 1))
     t = 0.5 * __log1p ((xa + xa) / (1.0 - xa));
   else
     {
-      if (xa > 1.0)
+      if (isgreater(xa, 1.0))
 	return (x - x) / (x - x);
 
       return x / 0.0;
--- a/sysdeps/ieee754/dbl-64/w_exp.c
+++ b/sysdeps/ieee754/dbl-64/w_exp.c
@@ -29,12 +29,12 @@
 double
 __exp (double x)
 {
-  if (__builtin_expect (x > o_threshold, 0))
+  if (__builtin_expect (isgreater(x, o_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard_f (x, x, 6);
     }
-  else if (__builtin_expect (x < u_threshold, 0))
+  else if (__builtin_expect (isless(x, u_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard_f (x, x, 7);
--- a/sysdeps/ieee754/flt-32/e_atanhf.c
+++ b/sysdeps/ieee754/flt-32/e_atanhf.c
@@ -47,7 +47,7 @@
 {
   float xa = fabsf (x);
   float t;
-  if (xa < 0.5f)
+  if (isless(xa, 0.5f))
     {
       if (__builtin_expect (xa < 0x1.0p-28f, 0))
 	{
@@ -58,11 +58,11 @@
       t = xa + xa;
       t = 0.5f * __log1pf (t + t * xa / (1.0f - xa));
     }
-  else if (__builtin_expect (xa < 1.0f, 1))
+  else if (__builtin_expect (isless(xa, 1.0f), 1))
     t = 0.5f * __log1pf ((xa + xa) / (1.0f - xa));
   else
     {
-      if (xa > 1.0f)
+      if (isgreater(xa, 1.0f))
 	return (x - x) / (x - x);
 
       return x / 0.0f;
--- a/sysdeps/ieee754/flt-32/w_expf.c
+++ b/sysdeps/ieee754/flt-32/w_expf.c
@@ -29,12 +29,12 @@
 float
 __expf (float x)
 {
-  if (__builtin_expect (x > o_threshold, 0))
+  if (__builtin_expect (isgreater(x, o_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard_f (x, x, 106);
     }
-  else if (__builtin_expect (x < u_threshold, 0))
+  else if (__builtin_expect (isless(x, u_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard_f (x, x, 107);
--- a/sysdeps/ieee754/ldbl-96/w_expl.c
+++ b/sysdeps/ieee754/ldbl-96/w_expl.c
@@ -31,12 +31,12 @@
 long double
 __expl (long double x)
 {
-  if (__builtin_expect (x > o_threshold, 0))
+  if (__builtin_expect (isgreater(x, o_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard (x, x, 206);
     }
-  else if (__builtin_expect (x < u_threshold, 0))
+  else if (__builtin_expect (isless(x, u_threshold), 0))
     {
       if (_LIB_VERSION != _IEEE_)
 	return __kernel_standard (x, x, 207);

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]