diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2012-02-19 11:20:18 +0100 |
---|---|---|
committer | Carlos O'Donell <carlos_odonell@mentor.com> | 2012-05-01 14:14:33 -0400 |
commit | 21902de70da58fa02f2a2a0ce583263170203332 (patch) | |
tree | 08f3d01826a4c795b41968133736ada4ef43e0c2 /sysdeps | |
parent | b657f1c5583edc7205604bacc657b5cea47e99fc (diff) | |
download | glibc-21902de70da58fa02f2a2a0ce583263170203332.zip glibc-21902de70da58fa02f2a2a0ce583263170203332.tar.gz glibc-21902de70da58fa02f2a2a0ce583263170203332.tar.bz2 |
Use non-signaling floating-point comparisons in math functions.
(cherry-picked from commit 92221550d72bafcd322ac5ab2a951054184b7f1a)
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_atanh.c | 8 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/w_exp.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/e_atanhf.c | 8 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/w_expf.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/w_expl.c | 6 |
5 files changed, 17 insertions, 17 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c index 1f83e31..4366ddd 100644 --- a/sysdeps/ieee754/dbl-64/e_atanh.c +++ b/sysdeps/ieee754/dbl-64/e_atanh.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Free Software Foundation, Inc. +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. @@ -47,7 +47,7 @@ __ieee754_atanh (double x) { 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 @@ __ieee754_atanh (double x) 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; diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c index f1becff..f5af6b1 100644 --- a/sysdeps/ieee754/dbl-64/w_exp.c +++ b/sysdeps/ieee754/dbl-64/w_exp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Free Software Foundation, Inc. +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. @@ -29,12 +29,12 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ 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); diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c index d98a11e..a1d03b4 100644 --- a/sysdeps/ieee754/flt-32/e_atanhf.c +++ b/sysdeps/ieee754/flt-32/e_atanhf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Free Software Foundation, Inc. +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. @@ -47,7 +47,7 @@ __ieee754_atanhf (float x) { 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 @@ __ieee754_atanhf (float x) 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; diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c index 151c584..b4d0824 100644 --- a/sysdeps/ieee754/flt-32/w_expf.c +++ b/sysdeps/ieee754/flt-32/w_expf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Free Software Foundation, Inc. +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. @@ -29,12 +29,12 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ 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); diff --git a/sysdeps/ieee754/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c index 703a0a2..b66d03e 100644 --- a/sysdeps/ieee754/ldbl-96/w_expl.c +++ b/sysdeps/ieee754/ldbl-96/w_expl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Free Software Foundation, Inc. +/* Copyright (C) 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. @@ -31,12 +31,12 @@ u_threshold= -1.140019167866942050398521670162263001513e4; 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); |