diff options
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r-- | sysdeps/libm-ieee754/e_atan2l.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_asinhl.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_cexpf.c | 63 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_cexpl.c | 63 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_finitel.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_fpclassifyl.c | 12 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nan.c | 3 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nanf.c | 3 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_nanl.c | 3 |
9 files changed, 141 insertions, 12 deletions
diff --git a/sysdeps/libm-ieee754/e_atan2l.c b/sysdeps/libm-ieee754/e_atan2l.c index 6b76f96..e60f2d4 100644 --- a/sysdeps/libm-ieee754/e_atan2l.c +++ b/sysdeps/libm-ieee754/e_atan2l.c @@ -126,7 +126,7 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */ case 1: { u_int32_t sz; GET_LDOUBLE_EXP(sz,z); - SET_LDOUBLE_EXP(z,sy ^ 0x8000); + SET_LDOUBLE_EXP(z,sz ^ 0x8000); } return z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ diff --git a/sysdeps/libm-ieee754/s_asinhl.c b/sysdeps/libm-ieee754/s_asinhl.c index 865bc31..d5b3077 100644 --- a/sysdeps/libm-ieee754/s_asinhl.c +++ b/sysdeps/libm-ieee754/s_asinhl.c @@ -65,6 +65,6 @@ huge= 1.000000000000000000e+4900L; t = x*x; w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t))); } - if(hx>0x7fff) return w; else return -w; + if(hx>0x8000) return -w; else return w; } weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c new file mode 100644 index 0000000..14cfb19 --- /dev/null +++ b/sysdeps/libm-ieee754/s_cexpf.c @@ -0,0 +1,63 @@ +/* Return value of complex exponential function for float complex value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <complex.h> +#include <math.h> + + +__complex__ float +__cexpf (__complex__ float x) +{ + __complex__ float retval; + + if (isfinite (__real__ x)) + { + if (isfinite (__imag__ x)) + { + retval = __expf (__real__ x) * (__cosf (__imag__ x) + + 1i * __sinf (__imag__ x)); + } + else + /* If the imaginary part is +-inf or NaN and the real part is + not +-inf the result is NaN + iNan. */ + retval = __nanf ("") + 1.0i * __nanf (""); + } + else if (__isinff (__real__ x)) + { + if (isfinite (__imag__ x)) + { + if (signbit (__real__ x) == 0 && __imag__ x == 0.0) + retval = HUGE_VALF; + else + retval = ((signbit (__real__ x) ? 0.0 : HUGE_VALF) + * (__cosf (__imag__ x) + 1i * __sinf (__imag__ x))); + } + else if (signbit (__real__ x)) + retval = HUGE_VALF + 1.0i * __nanf (""); + else + retval = 0.0; + } + else + /* If the real part is NaN the result is NaN + iNan. */ + retval = __nanf ("") + 1.0i * __nanf (""); + + return retval; +} +weak_alias (__cexpf, cexpf) diff --git a/sysdeps/libm-ieee754/s_cexpl.c b/sysdeps/libm-ieee754/s_cexpl.c new file mode 100644 index 0000000..6b3d409 --- /dev/null +++ b/sysdeps/libm-ieee754/s_cexpl.c @@ -0,0 +1,63 @@ +/* Return value of complex exponential function for long double complex value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <complex.h> +#include <math.h> + + +__complex__ long double +__cexpl (__complex__ long double x) +{ + __complex__ long double retval; + + if (isfinite (__real__ x)) + { + if (isfinite (__imag__ x)) + { + retval = __expl (__real__ x) * (__cosl (__imag__ x) + + 1i * __sinl (__imag__ x)); + } + else + /* If the imaginary part is +-inf or NaN and the real part is + not +-inf the result is NaN + iNan. */ + retval = __nanl ("") + 1.0i * __nanl (""); + } + else if (__isinfl (__real__ x)) + { + if (isfinite (__imag x)) + { + if (signbit (__real__ x) == 0 && __imag__ x == 0.0) + retval = HUGE_VALL; + else + retval = ((signbit (__real__ x) ? 0.0 : HUGE_VALL) + * (__cosl (__imag__ x) + 1i * __sinl (__imag__ x))); + } + else if (signbit (__real__ x)) + retval = HUGE_VALL + 1.0i * __nanl (""); + else + retval = 0.0; + } + else + /* If the real part is NaN the result is NaN + iNan. */ + retval = __nanl ("") + 1.0i * __nanl (""); + + return retval; +} +weak_alias (__cexpl, cexpl) diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c index 4423726..6e444e9 100644 --- a/sysdeps/libm-ieee754/s_finitel.c +++ b/sysdeps/libm-ieee754/s_finitel.c @@ -35,6 +35,6 @@ static char rcsid[] = "$NetBSD: $"; { int32_t exp; GET_LDOUBLE_EXP(exp,x); - return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>15); + return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>31); } weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-ieee754/s_fpclassifyl.c b/sysdeps/libm-ieee754/s_fpclassifyl.c index d7a0e94..4df0b44 100644 --- a/sysdeps/libm-ieee754/s_fpclassifyl.c +++ b/sysdeps/libm-ieee754/s_fpclassifyl.c @@ -2,6 +2,7 @@ Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + Fixed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -26,19 +27,18 @@ int __fpclassifyl (long double x) { - u_int32_t ex, hx, lx; + u_int32_t ex, hx, lx, m; int retval = FP_NORMAL; GET_LDOUBLE_WORDS (ex, hx, lx, x); - hx &= 0x7fffffff; - hx |= lx; + m = (hx & 0x7fffffff) | lx; ex &= 0x7fff; - if ((ex | hx) == 0) + if ((ex | m) == 0) retval = FP_ZERO; - else if (ex == 0) + else if (ex == 0 && (hx & 0x80000000) == 0) retval = FP_SUBNORMAL; else if (ex == 0x7fff) - retval = hx != 0 ? FP_NAN : FP_INFINITE; + retval = m != 0 ? FP_NAN : FP_INFINITE; return retval; } diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c index 58551c1..0d065d5c 100644 --- a/sysdeps/libm-ieee754/s_nan.c +++ b/sysdeps/libm-ieee754/s_nan.c @@ -31,7 +31,7 @@ double -nan (const char *tagp) +__nan (const char *tagp) { #ifdef HANDLE_TAGP /* If we ever should have use of the TAGP parameter we will use the @@ -45,3 +45,4 @@ nan (const char *tagp) return nan_value.d; #endif } +weak_alias (__nan, nan) diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c index e965b94..660f30d 100644 --- a/sysdeps/libm-ieee754/s_nanf.c +++ b/sysdeps/libm-ieee754/s_nanf.c @@ -31,7 +31,7 @@ float -nanf (const char *tagp) +__nanf (const char *tagp) { #ifdef HANDLE_TAGP /* If we ever should have use of the TAGP parameter we will use the @@ -45,3 +45,4 @@ nanf (const char *tagp) return nan_value.f; #endif } +weak_alias (__nanf, nanf) diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c index df0180e..4ade804 100644 --- a/sysdeps/libm-ieee754/s_nanl.c +++ b/sysdeps/libm-ieee754/s_nanl.c @@ -31,7 +31,7 @@ long double -nanl (const char *tagp) +__nanl (const char *tagp) { #ifdef HANDLE_TAGP /* If we ever should have use of the TAGP parameter we will use the @@ -46,3 +46,4 @@ nanl (const char *tagp) return nan_value.d; #endif } +weak_alias (__nanl, nanl) |