diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /sysdeps/ieee754/dbl-64 | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 glibc-a334319f6530564d22e775935d9c91663623a1b4.zip |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r-- | sysdeps/ieee754/dbl-64/Dist | 33 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_exp2.c | 7 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_pow.c | 22 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/halfulp.c | 4 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_llrint.c | 23 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_lrint.c | 21 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_sincos.c | 6 |
7 files changed, 77 insertions, 39 deletions
diff --git a/sysdeps/ieee754/dbl-64/Dist b/sysdeps/ieee754/dbl-64/Dist new file mode 100644 index 0000000000..4920caedcc --- /dev/null +++ b/sysdeps/ieee754/dbl-64/Dist @@ -0,0 +1,33 @@ +asincos.tbl +atnat.h +atnat2.h +branred.h +dla.h +doasin.h +dosincos.h +MathLib.h +mpa.h +mpa2.h +mpatan.h +mpexp.h +mplog.h +mpsqrt.h +mydefs.h +powtwo.tbl +root.tbl +sincos.tbl +sincos32.h +t_exp2.h +uasncs.h +uatan.tbl +uexp.h +uexp.tbl +ulog.h +ulog.tbl +upow.h +upow.tbl +urem.h +uroot.h +usncs.h +utan.h +utan.tbl diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c index ce6368be43..397acd182c 100644 --- a/sysdeps/ieee754/dbl-64/e_exp2.c +++ b/sysdeps/ieee754/dbl-64/e_exp2.c @@ -1,5 +1,5 @@ /* Double-precision floating point 2^x. - Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -37,11 +37,6 @@ #include "t_exp2.h" -/* XXX I know the assembler generates a warning about incorrect section - attributes. But without the attribute here the compiler places the - constants in the .data section. Ideally the constant is placed in - .rodata.cst8 so that it can be merged, but gcc sucks, it ICEs when - we try to force this section on it. --drepper */ static const volatile double TWO1023 = 8.988465674311579539e+307; static const volatile double TWOM1000 = 9.3326361850321887899e-302; diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c index 1e159f2c0b..d9bd8b479f 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -106,28 +106,20 @@ double __ieee754_pow(double x, double y) { else return y < 0 ? 1.0/ABS(x) : 0.0; /* return 0 */ } - - qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */ - qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */ - - if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) return NaNQ.x; - if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0)) - return x == 1.0 ? 1.0 : NaNQ.x; - /* if x<0 */ if (u.i[HIGH_HALF] < 0) { k = checkint(y); if (k==0) { - if (qy == 0x7ff00000) { + if ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) { if (x == -1.0) return 1.0; else if (x > -1.0) return v.i[HIGH_HALF] < 0 ? INF.x : 0.0; else return v.i[HIGH_HALF] < 0 ? 0.0 : INF.x; } - else if (qx == 0x7ff00000) + else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) return y < 0 ? 0.0 : INF.x; return NaNQ.x; /* y not integer and x<0 */ } - else if (qx == 0x7ff00000) + else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) { if (k < 0) return y < 0 ? nZERO.x : nINF.x; @@ -137,6 +129,14 @@ double __ieee754_pow(double x, double y) { return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */ } /* x>0 */ + qx = u.i[HIGH_HALF]&0x7fffffff; /* no sign */ + qy = v.i[HIGH_HALF]&0x7fffffff; /* no sign */ + + if (qx > 0x7ff00000 || (qx == 0x7ff00000 && u.i[LOW_HALF] != 0)) return NaNQ.x; + /* if 0<x<2^-0x7fe */ + if (qy > 0x7ff00000 || (qy == 0x7ff00000 && v.i[LOW_HALF] != 0)) + return x == 1.0 ? 1.0 : NaNQ.x; + /* if y<2^-0x7fe */ if (qx == 0x7ff00000) /* x= 2^-0x3ff */ {if (y == 0) return NaNQ.x; diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c index 478a4bacf6..9e1111b8db 100644 --- a/sysdeps/ieee754/dbl-64/halfulp.c +++ b/sysdeps/ieee754/dbl-64/halfulp.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2005 Free Software Foundation + * Copyright (C) 2001 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -42,7 +42,7 @@ double __ieee754_sqrt(double x); -static const int4 tab54[32] = { +int4 tab54[32] = { 262143, 11585, 1782, 511, 210, 107, 63, 42, 30, 22, 17, 14, 12, 10, 9, 7, 7, 6, 5, 5, 5, 4, 4, 4, diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c index 64c870eaaa..893bd716b5 100644 --- a/sysdeps/ieee754/dbl-64/s_llrint.c +++ b/sysdeps/ieee754/dbl-64/s_llrint.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -23,7 +23,7 @@ #include "math_private.h" -static const double two52[2] = +static const long double two52[2] = { 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ @@ -48,14 +48,19 @@ __llrint (double x) if (j0 < 20) { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; + if (j0 < -1) + return 0; + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; - result = (j0 < 0 ? 0 : i0 >> (20 - j0)); + result = i0 >> (20 - j0); + } } else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) { diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c index 1084ed6e2d..2da68d4dcd 100644 --- a/sysdeps/ieee754/dbl-64/s_lrint.c +++ b/sysdeps/ieee754/dbl-64/s_lrint.c @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -48,14 +48,19 @@ __lrint (double x) if (j0 < 20) { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; + if (j0 < -1) + return 0; + else + { + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; - result = (j0 < 0 ? 0 : i0 >> (20 - j0)); + result = i0 >> (20 - j0); + } } else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) { diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c index e946f9f976..f0542c500c 100644 --- a/sysdeps/ieee754/dbl-64/s_sincos.c +++ b/sysdeps/ieee754/dbl-64/s_sincos.c @@ -1,5 +1,5 @@ /* Compute sine and cosine of argument. - Copyright (C) 1997, 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -40,8 +40,8 @@ __sincos (double x, double *sinx, double *cosx) } else { - *sinx = __sin (x); - *cosx = __cos (x); + *sinx = sin (x); + *cosx = cos (x); } } weak_alias (__sincos, sincos) |