diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-128')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/Dist | 2 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/e_powl.c | 2 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/printf_fphex.c | 4 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_llrintl.c | 10 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_lrintl.c | 23 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_nextafterl.c | 18 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_nexttoward.c | 23 |
7 files changed, 45 insertions, 37 deletions
diff --git a/sysdeps/ieee754/ldbl-128/Dist b/sysdeps/ieee754/ldbl-128/Dist new file mode 100644 index 0000000000..4504060729 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128/Dist @@ -0,0 +1,2 @@ +ieee754.h +t_expl.h diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c index ba7e27b7d7..18bf237e65 100644 --- a/sysdeps/ieee754/ldbl-128/e_powl.c +++ b/sysdeps/ieee754/ldbl-128/e_powl.c @@ -220,7 +220,7 @@ __ieee754_powl (x, y) { if (((ix - 0x3fff0000) | p.parts32.w1 | p.parts32.w2 | p.parts32.w3) == 0) - return y - y; /* +-1**inf is NaN */ + return y - y; /* inf**+-1 is NaN */ else if (ix >= 0x3fff0000) /* (|x|>1)**+-inf = inf,0 */ return (hy >= 0) ? y : zero; else /* (|x|<1)**-,+inf = inf,0 */ diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c index 361a9baa05..0cb6b293e0 100644 --- a/sysdeps/ieee754/ldbl-128/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -1,6 +1,6 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -103,4 +103,4 @@ do { \ } \ } while (0) -#include <stdio-common/printf_fphex.c> +#include <sysdeps/generic/printf_fphex.c> diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c index 5804f57d11..d6899e8500 100644 --- a/sysdeps/ieee754/ldbl-128/s_llrintl.c +++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and Jakub Jelinek <jj@ultra.linux.cz>, 1999. @@ -48,16 +48,16 @@ __llrintl (long double x) if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) { + if (j0 < -1) + return 0; w = two112[sx] + x; t = w - two112[sx]; - GET_LDOUBLE_WORDS64 (i0, i1, t); + GET_LDOUBLE_WORDS64 (i0, i1, x); j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; i0 &= 0x0000ffffffffffffLL; i0 |= 0x0001000000000000LL; - if (j0 < 0) - result = 0; - else if (j0 <= 48) + if (j0 <= 48) result = i0 >> (48 - j0); else result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0)); diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c index ead24e99f0..66f9a429fc 100644 --- a/sysdeps/ieee754/ldbl-128/s_lrintl.c +++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and Jakub Jelinek <jj@ultra.linux.cz>, 1999. @@ -48,14 +48,19 @@ __lrintl (long double x) if (j0 < 48) { - w = two112[sx] + x; - t = w - two112[sx]; - GET_LDOUBLE_WORDS64 (i0, i1, t); - j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; - i0 &= 0x0000ffffffffffffLL; - i0 |= 0x0001000000000000LL; + if (j0 < -1) + return 0; + else + { + w = two112[sx] + x; + t = w - two112[sx]; + GET_LDOUBLE_WORDS64 (i0, i1, x); + j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; + i0 &= 0x0000ffffffffffffLL; + i0 |= 0x0001000000000000LL; - result = (j0 < 0 ? 0 : i0 >> (48 - j0)); + result = i0 >> (48 - j0); + } } else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) { @@ -65,7 +70,7 @@ __lrintl (long double x) { w = two112[sx] + x; t = w - two112[sx]; - GET_LDOUBLE_WORDS64 (i0, i1, t); + GET_LDOUBLE_WORDS64 (i0, i1, x); j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; i0 &= 0x0000ffffffffffffLL; i0 |= 0x0001000000000000LL; diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c index 7bc869a518..d3df668178 100644 --- a/sysdeps/ieee754/ldbl-128/s_nextafterl.c +++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c @@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include <math_private.h> +#include "math_private.h" #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -47,12 +47,9 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - long double u; SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */ - u = math_opt_barrier (x); - u = u * u; - math_force_eval (u); /* raise underflow flag */ - return x; + y = x*x; + if(y==x) return y; else return x; /* raise underflow flag */ } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ @@ -73,9 +70,12 @@ static char rcsid[] = "$NetBSD: $"; } hy = hx&0x7fff000000000000LL; if(hy==0x7fff000000000000LL) return x+x;/* overflow */ - if(hy==0) { - long double u = x*x; /* underflow */ - math_force_eval (u); /* raise underflow flag */ + if(hy==0) { /* underflow */ + y = x*x; + if(y!=x) { /* raise underflow flag */ + SET_LDOUBLE_WORDS64(y,hx,lx); + return y; + } } SET_LDOUBLE_WORDS64(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c index 178505c58f..553e401973 100644 --- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c +++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include <math_private.h> +#include "math_private.h" #include <float.h> #ifdef __STDC__ @@ -53,12 +53,10 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double u; + double x2; INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - u = math_opt_barrier (x); - u = u * u; - math_force_eval (u); /* raise underflow flag */ - return x; + x2 = x*x; + if(x2==x) return x2; else return x; /* raise underflow flag */ } if(hx>=0) { /* x > 0 */ if (hy<0||(ix>>20)>(iy>>48)-0x3c00 @@ -89,13 +87,16 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to double. */ - asm ("" : "+m"(x)); + /* Force conversion to float. */ + asm ("" : "=m"(x) : "m"(x)); return x; } - if(hy<0x00100000) { - double u = x*x; /* underflow */ - math_force_eval (u); /* raise underflow flag */ + if(hy<0x00100000) { /* underflow */ + double x2 = x*x; + if(x2!=x) { /* raise underflow flag */ + INSERT_WORDS(x2,hx,lx); + return x2; + } } INSERT_WORDS(x,hx,lx); return x; |