diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_finite.c | 1 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_isinf_ns.c | 20 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_isnan.c | 1 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c | 1 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c | 20 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c | 1 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_finitef.c | 1 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_isinf_nsf.c | 20 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_isnanf.c | 3 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_isinf_nsl.c | 19 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/s_isinf_nsl.c | 18 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/math_private.h | 21 |
12 files changed, 125 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c index 90de0f9d11..2ca3bf2454 100644 --- a/sysdeps/ieee754/dbl-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/s_finite.c @@ -22,6 +22,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; #include "math.h" #include "math_private.h" +#undef __finite #ifdef __STDC__ int __finite(double x) #else diff --git a/sysdeps/ieee754/dbl-64/s_isinf_ns.c b/sysdeps/ieee754/dbl-64/s_isinf_ns.c new file mode 100644 index 0000000000..065522ed80 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/s_isinf_ns.c @@ -0,0 +1,20 @@ +/* + * Written by Ulrich Drepper <drepper@gmail.com>. + */ + +/* + * __isinf_ns(x) returns != 0 if x is ±inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#undef __isinf_ns +int +__isinf_ns (double x) +{ + int32_t hx,lx; + EXTRACT_WORDS(hx,lx,x); + return !(lx | ((hx & 0x7fffffff) ^ 0x7ff00000)); +} diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c index 3a089e99a8..74e8291609 100644 --- a/sysdeps/ieee754/dbl-64/s_isnan.c +++ b/sysdeps/ieee754/dbl-64/s_isnan.c @@ -22,6 +22,7 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; #include "math.h" #include "math_private.h" +#undef __isnan #ifdef __STDC__ int __isnan(double x) #else diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c index 585f63e571..93a39a6835 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c @@ -17,6 +17,7 @@ #include "math.h" #include "math_private.h" +#undef __finite int __finite(double x) { diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c new file mode 100644 index 0000000000..09dcc94532 --- /dev/null +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c @@ -0,0 +1,20 @@ +/* + * Written by Ulrich Drepper <drepper@gmail.com>. + */ + +/* + * __isinf_ns(x) returns != 0 if x is ±inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#undef __isinf_ns +int +__isinf_ns (double x) +{ + int64_t ix; + EXTRACT_WORDS64(ix,x); + return (ix & UINT64_C(0x7fffffffffffffff)) == UINT64_C(0x7ff0000000000000); +} diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c index 3b08c54dd4..65dc8934f9 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c @@ -18,6 +18,7 @@ #include "math.h" #include "math_private.h" +#undef __isnan #ifdef __STDC__ int __isnan(double x) #else diff --git a/sysdeps/ieee754/flt-32/s_finitef.c b/sysdeps/ieee754/flt-32/s_finitef.c index 65767f8f93..2df513be75 100644 --- a/sysdeps/ieee754/flt-32/s_finitef.c +++ b/sysdeps/ieee754/flt-32/s_finitef.c @@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $" #include "math.h" #include "math_private.h" +#undef __finitef #ifdef __STDC__ int __finitef(float x) #else diff --git a/sysdeps/ieee754/flt-32/s_isinf_nsf.c b/sysdeps/ieee754/flt-32/s_isinf_nsf.c new file mode 100644 index 0000000000..bc37785168 --- /dev/null +++ b/sysdeps/ieee754/flt-32/s_isinf_nsf.c @@ -0,0 +1,20 @@ +/* + * Written by Ulrich Drepper <drepper@gmail.com>. + */ + +/* + * __isinf_nsf(x) returns != 0 if x is ±inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +#undef __isinf_nsf +int +__isinf_nsf (float x) +{ + int32_t ix,t; + GET_FLOAT_WORD(ix,x); + return (ix & 0x7fffffff) == 0x7f800000; +} diff --git a/sysdeps/ieee754/flt-32/s_isnanf.c b/sysdeps/ieee754/flt-32/s_isnanf.c index 4ac16c2b5f..1b1b2475b9 100644 --- a/sysdeps/ieee754/flt-32/s_isnanf.c +++ b/sysdeps/ieee754/flt-32/s_isnanf.c @@ -4,7 +4,7 @@ /* * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * Copyright (C) 1993, 2011 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this @@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_isnanf.c,v 1.4 1995/05/10 20:47:38 jtc Exp $"; #include "math.h" #include "math_private.h" +#undef __isnanf #ifdef __STDC__ int __isnanf(float x) #else diff --git a/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c b/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c new file mode 100644 index 0000000000..1ebc1accbc --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/s_isinf_nsl.c @@ -0,0 +1,19 @@ +/* + * Written by Ulrich Drepper <drepper@gmail.com> + */ + +/* + * __isinf_nsl(x) returns != 0 if x is ±inf, else 0; + * no branching! + */ + +#include "math.h" +#include "math_private.h" + +int +__isinf_nsl (long double x) +{ + int64_t hx,lx; + GET_LDOUBLE_WORDS64(hx,lx,x); + return !(lx | ((hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL)); +} diff --git a/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c b/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c new file mode 100644 index 0000000000..aa590307ea --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/s_isinf_nsl.c @@ -0,0 +1,18 @@ +/* + * Written by Ulrich Drepper <drepper@gmail.com>. + */ + +/* + * __isinf_nsl(x) returns != 0 if x is ±inf, else 0; + */ + +#include "math.h" +#include "math_private.h" + +int +__isinf_nsl (long double x) +{ + int32_t se,hx,lx; + GET_LDOUBLE_WORDS(se,hx,lx,x); + return !(((se & 0x7fff) ^ 0x7fff) | lx | (hx & 0x7fffffff)); +} diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h index 4be753654a..37357d317a 100644 --- a/sysdeps/x86_64/fpu/math_private.h +++ b/sysdeps/x86_64/fpu/math_private.h @@ -56,3 +56,24 @@ do { \ } while (0) #endif + +#define __isnan(d) \ + ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; }) +#define __isnanf(d) \ + ({ int __di; GET_FLOAT_WORD (__di, d); \ + (__di & 0x7fffffff) > 0x7f800000; }) + +#define __isinf_ns(d) \ + ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; }) +#define __isinf_nsf(d) \ + ({ int __di; GET_FLOAT_WORD (__di, d); \ + (__di & 0x7fffffff) == 0x7f800000; }) + +#define __finite(d) \ + ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; }) +#define __finitef(d) \ + ({ int __di; GET_FLOAT_WORD (__di, d); \ + (__di & 0x7fffffff) < 0x7f800000; }) |