diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/ieee754/dbl-64 | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
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, 39 insertions, 77 deletions
diff --git a/sysdeps/ieee754/dbl-64/Dist b/sysdeps/ieee754/dbl-64/Dist deleted file mode 100644 index 4920caedcc..0000000000 --- a/sysdeps/ieee754/dbl-64/Dist +++ /dev/null @@ -1,33 +0,0 @@ -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 397acd182c..ce6368be43 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 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -37,6 +37,11 @@ #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 d9bd8b479f..1e159f2c0b 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -106,20 +106,28 @@ 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 ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) { + if (qy == 0x7ff00000) { 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 (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) + else if (qx == 0x7ff00000) return y < 0 ? 0.0 : INF.x; return NaNQ.x; /* y not integer and x<0 */ } - else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0) + else if (qx == 0x7ff00000) { if (k < 0) return y < 0 ? nZERO.x : nINF.x; @@ -129,14 +137,6 @@ 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 9e1111b8db..478a4bacf6 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 Free Software Foundation + * Copyright (C) 2001, 2005 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); -int4 tab54[32] = { +static const 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 893bd716b5..64c870eaaa 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 Free Software Foundation, Inc. + Copyright (C) 1997, 2004, 2006 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 long double two52[2] = +static const double two52[2] = { 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ @@ -48,19 +48,14 @@ __llrint (double x) if (j0 < 20) { - 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; + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; - result = i0 >> (20 - j0); - } + result = (j0 < 0 ? 0 : 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 2da68d4dcd..1084ed6e2d 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 Free Software Foundation, Inc. + Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -48,19 +48,14 @@ __lrint (double x) if (j0 < 20) { - 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; + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; - result = i0 >> (20 - j0); - } + result = (j0 < 0 ? 0 : 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 f0542c500c..e946f9f976 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 Free Software Foundation, Inc. + Copyright (C) 1997, 2001, 2005 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) |