diff options
| author | Roland McGrath <roland@gnu.org> | 2006-02-01 03:02:06 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 2006-02-01 03:02:06 +0000 |
| commit | fea3f995bd004c0e31898eed82d5e15113d50e70 (patch) | |
| tree | 280dc2bf155fc93fce1a03f5c5759de64f5b58fe | |
| parent | d22429909099d9cae79b946ed878c484b0d97fbf (diff) | |
| download | glibc-fea3f995bd004c0e31898eed82d5e15113d50e70.tar.xz glibc-fea3f995bd004c0e31898eed82d5e15113d50e70.zip | |
* math/divtc3.c: New file.
* math/multc3.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
[$(subdir) = math] (libm-routines): Add multc3, divtc3.
* sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies: New file.
* sysdeps/sparc/sparc32/fpu/s_fabsl.c: Include math.h and
math_ldbl_opt.h.
(fabsl): Use long_double_symbol instead of weak_alias.
* sysdeps/sparc/sparc32/fpu/s_fabs.c: Include math.h and
math_ldbl_opt.h.
[LONG_DOUBLE_COMPAT] (fabsl): Add compat_symbol.
2006-01-31 Martin Schwidefsky <schwidefsky@de.ibm.com>
Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/s390/Implies: New file.
* sysdeps/unix/sysv/linux/s390/fpu/Implies: New file.
* sysdeps/unix/sysv/linux/s390/nldbl-abi.h: New file.
* sysdeps/s390/fpu/bits/mathinline.h (signbitl, sqrtl): New inlines.
* sysdeps/s390/bits/mathdef.h: New file.
* sysdeps/s390/fpu/e_sqrtl.c: New file.
* sysdeps/s390/s390-32/bits/wordsize.h (__LONG_DOUBLE_MATH_OPTIONAL,
__NO_LONG_DOUBLE_MATH): Define.
* sysdeps/s390/s390-64/bits/wordsize.h: Likewise.
* sysdeps/s390/Implies: Add ieee754/ldbl-128.
* sysdeps/s390/ldbl2mpn.c: File removed.
* sysdeps/s390/fpu/libm-test-ulps: Updated.
2006-01-31 Roland McGrath <roland@redhat.com>
* sysdeps/alpha/fpu/bits/mathdef.h: Moved to ...
* sysdeps/alpha/bits/mathdef.h: ... here.
* sysdeps/i386/fpu/bits/mathdef.h: Moved to ...
* sysdeps/i386/bits/mathdef.h: ... here.
* sysdeps/mips/fpu/bits/mathdef.h: Moved to ...
* sysdeps/mips/bits/mathdef.h: ... here.
* sysdeps/m68k/fpu/bits/mathdef.h: Moved to ...
* sysdeps/m68k/bits/mathdef.h: ... here.
* sysdeps/powerpc/fpu/bits/mathdef.h: Moved to ...
* sysdeps/powerpc/bits/mathdef.h: ... here.
* sysdeps/sparc/fpu/bits/mathdef.h: Moved to ...
* sysdeps/sparc/bits/mathdef.h: ... here.
* sysdeps/ia64/fpu/bits/mathdef.h: Moved to ...
* sysdeps/ia64/bits/mathdef.h: ... here.
* sysdeps/sh/sh4/fpu/bits/mathdef.h: Moved to ...
* sysdeps/sh/sh4/bits/mathdef.h: ... here.
* sysdeps/x86_64/fpu/bits/mathdef.h: Moved to ...
* sysdeps/x86_64/bits/mathdef.h: ... here.
2006-01-31 Jakub Jelinek <jakub@redhat.com>
27 files changed, 834 insertions, 102 deletions
@@ -1,5 +1,57 @@ 2006-01-31 Jakub Jelinek <jakub@redhat.com> + * math/divtc3.c: New file. + * math/multc3.c: New file. + * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile + [$(subdir) = math] (libm-routines): Add multc3, divtc3. + + * sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies: New file. + * sysdeps/sparc/sparc32/fpu/s_fabsl.c: Include math.h and + math_ldbl_opt.h. + (fabsl): Use long_double_symbol instead of weak_alias. + * sysdeps/sparc/sparc32/fpu/s_fabs.c: Include math.h and + math_ldbl_opt.h. + [LONG_DOUBLE_COMPAT] (fabsl): Add compat_symbol. + +2006-01-31 Martin Schwidefsky <schwidefsky@de.ibm.com> + Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/sysv/linux/s390/Implies: New file. + * sysdeps/unix/sysv/linux/s390/fpu/Implies: New file. + * sysdeps/unix/sysv/linux/s390/nldbl-abi.h: New file. + * sysdeps/s390/fpu/bits/mathinline.h (signbitl, sqrtl): New inlines. + * sysdeps/s390/bits/mathdef.h: New file. + * sysdeps/s390/fpu/e_sqrtl.c: New file. + * sysdeps/s390/s390-32/bits/wordsize.h (__LONG_DOUBLE_MATH_OPTIONAL, + __NO_LONG_DOUBLE_MATH): Define. + * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. + * sysdeps/s390/Implies: Add ieee754/ldbl-128. + * sysdeps/s390/ldbl2mpn.c: File removed. + * sysdeps/s390/fpu/libm-test-ulps: Updated. + +2006-01-31 Roland McGrath <roland@redhat.com> + + * sysdeps/alpha/fpu/bits/mathdef.h: Moved to ... + * sysdeps/alpha/bits/mathdef.h: ... here. + * sysdeps/i386/fpu/bits/mathdef.h: Moved to ... + * sysdeps/i386/bits/mathdef.h: ... here. + * sysdeps/mips/fpu/bits/mathdef.h: Moved to ... + * sysdeps/mips/bits/mathdef.h: ... here. + * sysdeps/m68k/fpu/bits/mathdef.h: Moved to ... + * sysdeps/m68k/bits/mathdef.h: ... here. + * sysdeps/powerpc/fpu/bits/mathdef.h: Moved to ... + * sysdeps/powerpc/bits/mathdef.h: ... here. + * sysdeps/sparc/fpu/bits/mathdef.h: Moved to ... + * sysdeps/sparc/bits/mathdef.h: ... here. + * sysdeps/ia64/fpu/bits/mathdef.h: Moved to ... + * sysdeps/ia64/bits/mathdef.h: ... here. + * sysdeps/sh/sh4/fpu/bits/mathdef.h: Moved to ... + * sysdeps/sh/sh4/bits/mathdef.h: ... here. + * sysdeps/x86_64/fpu/bits/mathdef.h: Moved to ... + * sysdeps/x86_64/bits/mathdef.h: ... here. + +2006-01-31 Jakub Jelinek <jakub@redhat.com> + * sysdeps/unix/sysv/linux/i386/fxstatat.c [XSTAT_IS_STAT64] (__fxstatat64): Add libc_hidden_ver. * sysdeps/unix/sysv/linux/fxstatat.c [XSTAT_IS_STAT64] (__fxstatat64): diff --git a/math/divtc3.c b/math/divtc3.c new file mode 100644 index 0000000000..d974ae6454 --- /dev/null +++ b/math/divtc3.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson <rth@redhat.com>, 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdbool.h> +#include <math.h> +#include <complex.h> + +attribute_hidden +long double _Complex +__divtc3 (long double a, long double b, long double c, long double d) +{ + long double denom, ratio, x, y; + + /* ??? We can get better behavior from logarithmic scaling instead of + the division. But that would mean starting to link libgcc against + libm. We could implement something akin to ldexp/frexp as gcc builtins + fairly easily... */ + if (fabsl (c) < fabsl (d)) + { + ratio = c / d; + denom = (c * ratio) + d; + x = ((a * ratio) + b) / denom; + y = ((b * ratio) - a) / denom; + } + else + { + ratio = d / c; + denom = (d * ratio) + c; + x = ((b * ratio) + a) / denom; + y = (b - (a * ratio)) / denom; + } + + /* Recover infinities and zeros that computed as NaN+iNaN; the only cases + are nonzero/zero, infinite/finite, and finite/infinite. */ + if (isnan (x) && isnan (y)) + { + if (denom == 0.0 && (!isnan (a) || !isnan (b))) + { + x = __copysignl (INFINITY, c) * a; + y = __copysignl (INFINITY, c) * b; + } + else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d)) + { + a = __copysignl (isinf (a) ? 1 : 0, a); + b = __copysignl (isinf (b) ? 1 : 0, b); + x = INFINITY * (a * c + b * d); + y = INFINITY * (b * c - a * d); + } + else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b)) + { + c = __copysignl (isinf (c) ? 1 : 0, c); + d = __copysignl (isinf (d) ? 1 : 0, d); + x = 0.0 * (a * c + b * d); + y = 0.0 * (b * c - a * d); + } + } + + return x + I * y; +} diff --git a/math/multc3.c b/math/multc3.c new file mode 100644 index 0000000000..6369f48f24 --- /dev/null +++ b/math/multc3.c @@ -0,0 +1,80 @@ +/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson <rth@redhat.com>, 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdbool.h> +#include <math.h> +#include <complex.h> + +attribute_hidden +long double _Complex +__multc3 (long double a, long double b, long double c, long double d) +{ + long double ac, bd, ad, bc, x, y; + + ac = a * c; + bd = b * d; + ad = a * d; + bc = b * c; + + x = ac - bd; + y = ad + bc; + + if (isnan (x) && isnan (y)) + { + /* Recover infinities that computed as NaN + iNaN. */ + bool recalc = 0; + if (isinf (a) || isinf (b)) + { + /* z is infinite. "Box" the infinity and change NaNs in + the other factor to 0. */ + a = __copysignl (isinf (a) ? 1 : 0, a); + b = __copysignl (isinf (b) ? 1 : 0, b); + if (isnan (c)) c = __copysignl (0, c); + if (isnan (d)) d = __copysignl (0, d); + recalc = 1; + } + if (isinf (c) || isinf (d)) + { + /* w is infinite. "Box" the infinity and change NaNs in + the other factor to 0. */ + c = __copysignl (isinf (c) ? 1 : 0, c); + d = __copysignl (isinf (d) ? 1 : 0, d); + if (isnan (a)) a = __copysignl (0, a); + if (isnan (b)) b = __copysignl (0, b); + recalc = 1; + } + if (!recalc + && (isinf (ac) || isinf (bd) || isinf (ad) || isinf (bc))) + { + /* Recover infinities from overflow by changing NaNs to 0. */ + if (isnan (a)) a = __copysignl (0, a); + if (isnan (b)) b = __copysignl (0, b); + if (isnan (c)) c = __copysignl (0, c); + if (isnan (d)) d = __copysignl (0, d); + recalc = 1; + } + if (recalc) + { + x = INFINITY * (a * c - b * d); + y = INFINITY * (a * d + b * c); + } + } + + return x + I * y; +} diff --git a/sysdeps/alpha/fpu/bits/mathdef.h b/sysdeps/alpha/bits/mathdef.h index d5f2d5a843..d5f2d5a843 100644 --- a/sysdeps/alpha/fpu/bits/mathdef.h +++ b/sysdeps/alpha/bits/mathdef.h diff --git a/sysdeps/i386/fpu/bits/mathdef.h b/sysdeps/i386/bits/mathdef.h index ec42ed5df9..ec42ed5df9 100644 --- a/sysdeps/i386/fpu/bits/mathdef.h +++ b/sysdeps/i386/bits/mathdef.h diff --git a/sysdeps/ia64/fpu/bits/mathdef.h b/sysdeps/ia64/bits/mathdef.h index 3dc2860223..3dc2860223 100644 --- a/sysdeps/ia64/fpu/bits/mathdef.h +++ b/sysdeps/ia64/bits/mathdef.h diff --git a/sysdeps/m68k/fpu/bits/mathdef.h b/sysdeps/m68k/bits/mathdef.h index 65cf8d49f6..65cf8d49f6 100644 --- a/sysdeps/m68k/fpu/bits/mathdef.h +++ b/sysdeps/m68k/bits/mathdef.h diff --git a/sysdeps/mips/fpu/bits/mathdef.h b/sysdeps/mips/bits/mathdef.h index 99be0db2b5..99be0db2b5 100644 --- a/sysdeps/mips/fpu/bits/mathdef.h +++ b/sysdeps/mips/bits/mathdef.h diff --git a/sysdeps/powerpc/fpu/bits/mathdef.h b/sysdeps/powerpc/bits/mathdef.h index b79cc6ff96..b79cc6ff96 100644 --- a/sysdeps/powerpc/fpu/bits/mathdef.h +++ b/sysdeps/powerpc/bits/mathdef.h diff --git a/sysdeps/s390/Implies b/sysdeps/s390/Implies index 5b29b26128..1945b1f4bb 100644 --- a/sysdeps/s390/Implies +++ b/sysdeps/s390/Implies @@ -1,2 +1,3 @@ +ieee754/ldbl-128 ieee754/dbl-64 ieee754/flt-32 diff --git a/sysdeps/s390/bits/mathdef.h b/sysdeps/s390/bits/mathdef.h new file mode 100644 index 0000000000..4dcb612c33 --- /dev/null +++ b/sysdeps/s390/bits/mathdef.h @@ -0,0 +1,38 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006 + 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use <bits/mathdef.h> directly; include <math.h> instead" +#endif + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +/* Normally, there is no long double type and the `float' and `double' + expressions are evaluated as `double'. */ +typedef double float_t; /* `float' expressions are evaluated as + `double'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647) +# define FP_ILOGBNAN 2147483647 + +#endif /* ISO C99 */ diff --git a/sysdeps/s390/fpu/bits/mathinline.h b/sysdeps/s390/fpu/bits/mathinline.h index 381f2e0bcb..5c6b83ad06 100644 --- a/sysdeps/s390/fpu/bits/mathinline.h +++ b/sysdeps/s390/fpu/bits/mathinline.h @@ -47,6 +47,21 @@ __NTH (__signbit (double __x)) return __u.__i < 0; } +# ifndef __NO_LONG_DOUBLE_MATH +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + __extension__ union { long double __l; int __i[4]; } __u = { __l: __x }; + return __u.__i[0] < 0; +} +# else +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + return __signbit ((double) __x); +} +# endif + #endif /* C99 */ /* This code is used internally in the GNU libc. */ @@ -70,6 +85,17 @@ __NTH (__ieee754_sqrtf (float x)) return res; } +# if !defined __NO_LONG_DOUBLE_MATH +__MATH_INLINE long double +__NTH (sqrtl (long double __x)) +{ + long double res; + + asm ( "sqxbr %0,%1" : "=f" (res) : "f" (__x) ); + return res; +} +# endif /* !__NO_LONG_DOUBLE_MATH */ + #endif /* __LIBC_INTERNAL_MATH_INLINES */ #endif /* __NO_MATH_INLINES */ diff --git a/sysdeps/s390/fpu/e_sqrtl.c b/sysdeps/s390/fpu/e_sqrtl.c new file mode 100644 index 0000000000..e1daac1974 --- /dev/null +++ b/sysdeps/s390/fpu/e_sqrtl.c @@ -0,0 +1,30 @@ +/* Square root. S/390 FPU version. + Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <math_private.h> + +long double +__ieee754_sqrtl (long double x) +{ + long double res; + + asm ( "sqxbr %0,%1" : "=f" (res) : "f" (x) ); + return res; +} diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps index 06b022a47b..a84b71f54a 100644 --- a/sysdeps/s390/fpu/libm-test-ulps +++ b/sysdeps/s390/fpu/libm-test-ulps @@ -1,21 +1,35 @@ # Begin of automatic generation # atan2 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": +ildouble: 1 +ldouble: 1 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": float: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 # atanh Test "atanh (0.75) == 0.972955074527656652552676371721589865": float: 1 ifloat: 1 +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + # cacosh Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 @@ -27,6 +41,8 @@ double: 1 float: 3 idouble: 1 ifloat: 3 +ildouble: 1 +ldouble: 1 # casin Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.132393631605308195222663336968344 |
