diff options
Diffstat (limited to 'sysdeps/libm-ieee754')
30 files changed, 1630 insertions, 59 deletions
diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c index d46afb5494..ea070bc9b2 100644 --- a/sysdeps/libm-ieee754/k_standard.c +++ b/sysdeps/libm-ieee754/k_standard.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -33,7 +33,7 @@ static const double zero = 0.0; /* used as const */ static double zero = 0.0; /* used as const */ #endif -/* +/* * Standard conformance (non-IEEE) on exception cases. * Mapping: * 1 -- acos(|x|>1) @@ -58,7 +58,7 @@ static double zero = 0.0; /* used as const */ * 20-- pow(0.0,0.0) * 21-- pow(x,y) overflow * 22-- pow(x,y) underflow - * 23-- pow(0,negative) + * 23-- pow(0,negative) * 24-- pow(neg,non-integral) * 25-- sinh(finite) overflow * 26-- sqrt(negative) @@ -82,14 +82,14 @@ static double zero = 0.0; /* used as const */ #ifdef __STDC__ - double __kernel_standard(double x, double y, int type) + double __kernel_standard(double x, double y, int type) #else - double __kernel_standard(x,y,type) + double __kernel_standard(x,y,type) double x,y; int type; #endif { struct exception exc; -#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ +#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ #define HUGE_VAL inf double inf = 0.0; @@ -104,9 +104,11 @@ static double zero = 0.0; /* used as const */ switch(type) { case 1: case 101: + case 201: /* acos(|x|>1) */ exc.type = DOMAIN; - exc.name = type < 100 ? "acos" : "acosf"; + exc.name = type < 100 ? "acos" : (type < 200 + ? "acosf" : "acosl");; exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = EDOM; @@ -119,9 +121,11 @@ static double zero = 0.0; /* used as const */ break; case 2: case 102: + case 202: /* asin(|x|>1) */ exc.type = DOMAIN; - exc.name = type < 100 ? "asin" : "asinf"; + exc.name = type < 100 ? "asin" : (type < 200 + ? "asinf" : "asinl"); exc.retval = zero; if(_LIB_VERSION == _POSIX_) errno = EDOM; @@ -134,11 +138,13 @@ static double zero = 0.0; /* used as const */ break; case 3: case 103: + case 203: /* atan2(+-0,+-0) */ exc.arg1 = y; exc.arg2 = x; exc.type = DOMAIN; - exc.name = type < 100 ? "atan2" : "atan2f"; + exc.name = type < 100 ? "atan2" : (type < 200 + ? "atan2f" : "atan2l"); exc.retval = zero; if(_LIB_VERSION == _POSIX_) errno = EDOM; @@ -151,9 +157,11 @@ static double zero = 0.0; /* used as const */ break; case 4: case 104: + case 204: /* hypot(finite,finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "hypot" : "hypotf"; + exc.name = type < 100 ? "hypot" : (type < 200 + ? "hypotf" : "hypotl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -166,9 +174,11 @@ static double zero = 0.0; /* used as const */ break; case 5: case 105: + case 205: /* cosh(finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "cosh" : "coshf"; + exc.name = type < 100 ? "cosh" : (type < 200 + ? "coshf" : "coshl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -181,9 +191,11 @@ static double zero = 0.0; /* used as const */ break; case 6: case 106: + case 206: /* exp(finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "exp" : "expf"; + exc.name = type < 100 ? "exp" : (type < 200 + ? "expf" : "expl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -196,9 +208,11 @@ static double zero = 0.0; /* used as const */ break; case 7: case 107: + case 207: /* exp(finite) underflow */ exc.type = UNDERFLOW; - exc.name = type < 100 ? "exp" : "expf"; + exc.name = type < 100 ? "exp" : (type < 200 + ? "expf" : "expl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -208,9 +222,10 @@ static double zero = 0.0; /* used as const */ break; case 8: case 108: + case 208: /* y0(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "y0" : "y0f"; + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -226,9 +241,10 @@ static double zero = 0.0; /* used as const */ break; case 9: case 109: + case 209: /* y0(x<0) = NaN */ exc.type = DOMAIN; - exc.name = type < 100 ? "y0" : "y0f"; + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -244,9 +260,10 @@ static double zero = 0.0; /* used as const */ break; case 10: case 110: + case 210: /* y1(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "y1" : "y1f"; + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -262,9 +279,10 @@ static double zero = 0.0; /* used as const */ break; case 11: case 111: + case 211: /* y1(x<0) = NaN */ exc.type = DOMAIN; - exc.name = type < 100 ? "y1" : "y1f"; + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -280,9 +298,10 @@ static double zero = 0.0; /* used as const */ break; case 12: case 112: + case 212: /* yn(n,0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ - exc.name = type < 100 ? "yn" : "ynf"; + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -298,9 +317,10 @@ static double zero = 0.0; /* used as const */ break; case 13: case 113: + case 213: /* yn(x<0) = NaN */ exc.type = DOMAIN; - exc.name = type < 100 ? "yn" : "ynf"; + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -316,9 +336,11 @@ static double zero = 0.0; /* used as const */ break; case 14: case 114: + case 214: /* lgamma(finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "lgamma" : "lgammaf"; + exc.name = type < 100 ? "lgamma" : (type < 200 + ? "lgammaf" : "lgammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -331,9 +353,11 @@ static double zero = 0.0; /* used as const */ break; case 15: case 115: + case 215: /* lgamma(-integer) or lgamma(0) */ exc.type = SING; - exc.name = type < 100 ? "lgamma" : "lgammaf"; + exc.name = type < 100 ? "lgamma" : (type < 200 + ? "lgammaf" : "lgammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -349,9 +373,10 @@ static double zero = 0.0; /* used as const */ break; case 16: case 116: + case 216: /* log(0) */ exc.type = SING; - exc.name = type < 100 ? "log" : "logf"; + exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -367,9 +392,10 @@ static double zero = 0.0; /* used as const */ break; case 17: case 117: + case 217: /* log(x<0) */ exc.type = DOMAIN; - exc.name = type < 100 ? "log" : "logf"; + exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -385,9 +411,11 @@ static double zero = 0.0; /* used as const */ break; case 18: case 118: + case 218: /* log10(0) */ exc.type = SING; - exc.name = type < 100 ? "log10" : "log10f"; + exc.name = type < 100 ? "log10" : (type < 200 + ? "log10f" : "log10l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -403,9 +431,11 @@ static double zero = 0.0; /* used as const */ break; case 19: case 119: + case 219: /* log10(x<0) */ exc.type = DOMAIN; - exc.name = type < 100 ? "log10" : "log10f"; + exc.name = type < 100 ? "log10" : (type < 200 + ? "log10f" : "log10l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else @@ -421,10 +451,11 @@ static double zero = 0.0; /* used as const */ break; case 20: case 120: + case 220: /* pow(0.0,0.0) */ /* error only if _LIB_VERSION == _SVID_ */ exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : "powf"; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = zero; if (_LIB_VERSION != _SVID_) exc.retval = 1.0; else if (!matherr(&exc)) { @@ -434,9 +465,10 @@ static double zero = 0.0; /* used as const */ break; case 21: case 121: + case 221: /* pow(x,y) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "pow" : "powf"; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); if (_LIB_VERSION == _SVID_) { exc.retval = HUGE; y *= 0.5; @@ -454,9 +486,10 @@ static double zero = 0.0; /* used as const */ break; case 22: case 122: + case 222: /* pow(x,y) underflow */ exc.type = UNDERFLOW; - exc.name = type < 100 ? "pow" : "powf"; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -466,10 +499,11 @@ static double zero = 0.0; /* used as const */ break; case 23: case 123: + case 223: /* 0**neg */ exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : "powf"; - if (_LIB_VERSION == _SVID_) + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); + if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = -HUGE_VAL; @@ -484,14 +518,15 @@ static double zero = 0.0; /* used as const */ break; case 24: case 124: + case 224: /* neg**non-integral */ exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : "powf"; - if (_LIB_VERSION == _SVID_) + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); + if (_LIB_VERSION == _SVID_) exc.retval = zero; - else + else exc.retval = zero/zero; /* X/Open allow NaN */ - if (_LIB_VERSION == _POSIX_) + if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { @@ -502,9 +537,11 @@ static double zero = 0.0; /* used as const */ break; case 25: case 125: + case 225: /* sinh(finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "sinh" : "sinhf"; + exc.name = type < 100 ? "sinh" : (type < 200 + ? "sinhf" : "sinhl"); if (_LIB_VERSION == _SVID_) exc.retval = ( (x>zero) ? HUGE : -HUGE); else @@ -517,9 +554,11 @@ static double zero = 0.0; /* used as const */ break; case 26: case 126: + case 226: /* sqrt(x<0) */ exc.type = DOMAIN; - exc.name = type < 100 ? "sqrt" : "sqrtf"; + exc.name = type < 100 ? "sqrt" : (type < 200 + ? "sqrtf" : "sqrtl"); if (_LIB_VERSION == _SVID_) exc.retval = zero; else @@ -535,9 +574,11 @@ static double zero = 0.0; /* used as const */ break; case 27: case 127: + case 227: /* fmod(x,0) */ exc.type = DOMAIN; - exc.name = type < 100 ? "fmod" : "fmodf"; + exc.name = type < 100 ? "fmod" : (type < 200 + ? "fmodf" : "fmodl"); if (_LIB_VERSION == _SVID_) exc.retval = x; else @@ -553,9 +594,12 @@ static double zero = 0.0; /* used as const */ break; case 28: case 128: + case 228: /* remainder(x,0) */ exc.type = DOMAIN; - exc.name = type < 100 ? "remainder" : "remainderf"; + exc.name = type < 100 ? "remainder" : (type < 200 + ? "remainderf" + : "remainderl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) errno = EDOM; @@ -568,9 +612,11 @@ static double zero = 0.0; /* used as const */ break; case 29: case 129: + case 229: /* acosh(x<1) */ exc.type = DOMAIN; - exc.name = type < 100 ? "acosh" : "acoshf"; + exc.name = type < 100 ? "acosh" : (type < 200 + ? "acoshf" : "acoshl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) errno = EDOM; @@ -583,9 +629,11 @@ static double zero = 0.0; /* used as const */ break; case 30: case 130: + case 230: /* atanh(|x|>1) */ exc.type = DOMAIN; - exc.name = type < 100 ? "atanh" : "atanhf"; + exc.name = type < 100 ? "atanh" : (type < 200 + ? "atanhf" : "atanhl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) errno = EDOM; @@ -598,9 +646,11 @@ static double zero = 0.0; /* used as const */ break; case 31: case 131: + case 231: /* atanh(|x|=1) */ exc.type = SING; - exc.name = type < 100 ? "atanh" : "atanhf"; + exc.name = type < 100 ? "atanh" : (type < 200 + ? "atanhf" : "atanhl"); exc.retval = x/zero; /* sign(x)*inf */ if (_LIB_VERSION == _POSIX_) errno = EDOM; @@ -613,9 +663,11 @@ static double zero = 0.0; /* used as const */ break; case 32: case 132: + case 232: /* scalb overflow; SVID also returns +-HUGE_VAL */ exc.type = OVERFLOW; - exc.name = type < 100 ? "scalb" : "scalbf"; + exc.name = type < 100 ? "scalb" : (type < 200 + ? "scalbf" : "scalbl"); exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -625,9 +677,11 @@ static double zero = 0.0; /* used as const */ break; case 33: case 133: + case 233: /* scalb underflow */ exc.type = UNDERFLOW; - exc.name = type < 100 ? "scalb" : "scalbf"; + exc.name = type < 100 ? "scalb" : (type < 200 + ? "scalbf" : "scalbl"); exc.retval = __copysign(zero,x); if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -637,9 +691,10 @@ static double zero = 0.0; /* used as const */ break; case 34: case 134: + case 234: /* j0(|x|>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "j0" : "j0f"; + exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -649,13 +704,14 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 35: case 135: + case 235: /* y0(x>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "y0" : "y0f"; + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -665,13 +721,14 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 36: case 136: + case 236: /* j1(|x|>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "j1" : "j1f"; + exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -681,13 +738,14 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 37: case 137: + case 237: /* y1(x>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "y1" : "y1f"; + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -697,13 +755,14 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 38: case 138: + case 238: /* jn(|x|>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "jn" : "jnf"; + exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -713,13 +772,14 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 39: case 139: + case 239: /* yn(x>X_TLOSS) */ exc.type = TLOSS; - exc.name = type < 100 ? "yn" : "ynf"; + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) errno = ERANGE; @@ -729,13 +789,15 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 40: case 140: + case 240: /* gamma(finite) overflow */ exc.type = OVERFLOW; - exc.name = type < 100 ? "gamma" : "gammaf"; + exc.name = type < 100 ? "gamma" : (type < 200 + ? "gammaf" : "gammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -748,9 +810,11 @@ static double zero = 0.0; /* used as const */ break; case 41: case 141: + case 241: /* gamma(-integer) or gamma(0) */ exc.type = SING; - exc.name = type < 100 ? "gamma" : "gammaf"; + exc.name = type < 100 ? "gamma" : (type < 200 + ? "gammaf" : "gammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -766,10 +830,11 @@ static double zero = 0.0; /* used as const */ break; case 42: case 142: + case 242: /* pow(NaN,0.0) */ /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */ exc.type = DOMAIN; - exc.name = type < 100 ? "pow" : "powf"; + exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = x; if (_LIB_VERSION == _IEEE_ || _LIB_VERSION == _POSIX_) exc.retval = 1.0; @@ -778,5 +843,5 @@ static double zero = 0.0; /* used as const */ } break; } - return exc.retval; + return exc.retval; } diff --git a/sysdeps/libm-ieee754/s_ilogbl.c b/sysdeps/libm-ieee754/s_ilogbl.c new file mode 100644 index 0000000000..11372e0dc8 --- /dev/null +++ b/sysdeps/libm-ieee754/s_ilogbl.c @@ -0,0 +1,56 @@ +/* s_ilogbl.c -- long double version of s_ilogb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* ilogbl(long double x) + * return the binary exponent of non-zero x + * ilogbl(0) = 0x80000001 + * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + int __ilogbl(long double x) +#else + int __ilogbl(x) + long double x; +#endif +{ + int32_t es,hx,lx,ix; + + GET_LDOUBLE_EXP(es,x); + es &= 0x7fff; + if(es==0) { + GET_LDOUBLE_WORDS(es,hx,lx,x); + if((hx|lx)==0) + return 0x80000001; /* ilogbl(0) = 0x80000001 */ + else /* subnormal x */ + if(hx==0) { + for (ix = -16415; lx>0; lx<<=1) ix -=1; + } else { + for (ix = -16383; hx>0; hx<<=1) ix -=1; + } + return ix; + } + else if (es<0x7fff) return es-0x3fff; + else return 0x7fffffff; +} +weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c index 6d435f00b2..b35fc1c41c 100644 --- a/sysdeps/libm-ieee754/s_isinf.c +++ b/sysdeps/libm-ieee754/s_isinf.c @@ -31,5 +31,6 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; } weak_alias (__isinf, isinf) #ifdef NO_LONG_DOUBLE +strong_alias (__isinf, __isinfl) weak_alias (__isinf, isinfl) #endif diff --git a/sysdeps/libm-ieee754/s_logbl.c b/sysdeps/libm-ieee754/s_logbl.c new file mode 100644 index 0000000000..2cd9d105f8 --- /dev/null +++ b/sysdeps/libm-ieee754/s_logbl.c @@ -0,0 +1,47 @@ +/* s_logbl.c -- long double version of s_logb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * long double logbl(x) + * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. + * Use ilogb instead. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __logbl(long double x) +#else + long double __logbl(x) + long double x; +#endif +{ + int32_t es,lx,ix; + GET_LDOUBLE_WORDS(es,ix,lx,x); + es &= 0x7fff; /* exponent */ + if((es|ix|lx)==0) return -1.0/fabs(x); + if(es==0x7fff) return x*x; + if(es==0) /* IEEE 754 logb */ + return -16382.0; + else + return (long double) (es-0x3fff); +} +weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c new file mode 100644 index 0000000000..433c936240 --- /dev/null +++ b/sysdeps/libm-ieee754/s_modfl.c @@ -0,0 +1,88 @@ +/* s_modfl.c -- long double version of s_modf.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * modfl(long double x, long double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double one = 1.0; +#else +static long double one = 1.0; +#endif + +#ifdef __STDC__ + long double __modfl(long double x, long double *iptr) +#else + long double __modfl(x, iptr) + long double x,*iptr; +#endif +{ + int32_t i0,i1,j0; + u_int32_t i,se; + GET_LDOUBLE_WORDS(se,i0,i1,x); + j0 = (se&0x7fff)-0x3fff; /* exponent of x */ + if(j0<32) { /* integer part in high x */ + if(j0<0) { /* |x|<1 */ + SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ + return x; + } else { + i = (0xffffffff)>>j0; + if(((i0&i)|i1)==0) { /* x is integral */ + u_int32_t high; + *iptr = x; + GET_HIGH_WORD(high,x); + INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + return x; + } else { + INSERT_WORDS(*iptr,i0&(~i),0); + return x - *iptr; + } + } + } else if (j0>63) { /* no fraction part */ + u_int32_t high; + *iptr = x*one; + GET_HIGH_WORD(high,x); + INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + return x; + } else { /* fraction part in low x */ + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) { /* x is integral */ + u_int32_t high; + *iptr = x; + GET_HIGH_WORD(high,x); + INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */ + return x; + } else { + INSERT_WORDS(*iptr,i0,i1&(~i)); + return x - *iptr; + } + } +} +weak_alias (__modfl, modfl) diff --git a/sysdeps/libm-ieee754/w_acoshl.c b/sysdeps/libm-ieee754/w_acoshl.c new file mode 100644 index 0000000000..a37d4c15d9 --- /dev/null +++ b/sysdeps/libm-ieee754/w_acoshl.c @@ -0,0 +1,47 @@ +/* w_acoshl.c -- long double version of w_acosh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper acoshl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __acoshl(long double x) /* wrapper acosh */ +#else + long double __acoshl(x) /* wrapper acosh */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acoshl(x); +#else + long double z; + z = __ieee754_acoshl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(x<1.0) { + return __kernel_standard(x,x,229); /* acoshl(x<1) */ + } else + return z; +#endif +} +weak_alias (__acoshl, acoshl) diff --git a/sysdeps/libm-ieee754/w_acosl.c b/sysdeps/libm-ieee754/w_acosl.c new file mode 100644 index 0000000000..cd9cecf2f9 --- /dev/null +++ b/sysdeps/libm-ieee754/w_acosl.c @@ -0,0 +1,48 @@ +/* w_acosl.c -- long double version of w_acos.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrap_acosl(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __acosl(long double x) /* wrapper acos */ +#else + long double __acosl(x) /* wrapper acos */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acosl(x); +#else + long double z; + z = __ieee754_acosl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(fabsl(x)>1.0) { + return __kernel_standard(x,x,201); /* acosl(|x|>1) */ + } else + return z; +#endif +} +weak_alias (__acosl, acosl) diff --git a/sysdeps/libm-ieee754/w_asinl.c b/sysdeps/libm-ieee754/w_asinl.c new file mode 100644 index 0000000000..0ac3038e95 --- /dev/null +++ b/sysdeps/libm-ieee754/w_asinl.c @@ -0,0 +1,49 @@ +/* w_asinl.c -- long double version of w_asin.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper asinl(x) + */ + + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __asinl(long double x) /* wrapper asinl */ +#else + long double __asinl(x) /* wrapper asinl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_asinl(x); +#else + long double z; + z = __ieee754_asinl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(fabsl(x)>1.0) { + return __kernel_standard(x,x,202); /* asinl(|x|>1) */ + } else + return z; +#endif +} +weak_alias (__asinl, asinl) diff --git a/sysdeps/libm-ieee754/w_atan2l.c b/sysdeps/libm-ieee754/w_atan2l.c new file mode 100644 index 0000000000..9e6e56bbed --- /dev/null +++ b/sysdeps/libm-ieee754/w_atan2l.c @@ -0,0 +1,48 @@ +/* w_atan2l.c -- long double version of w_atan2.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper atan2l(y,x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __atan2l(long double y, long double x) /* wrapper atan2l */ +#else + long double __atan2l(y,x) /* wrapper atan2l */ + long double y,x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atan2l(y,x); +#else + long double z; + z = __ieee754_atan2l(y,x); + if(_LIB_VERSION == _IEEE_||__isnanl(x)||__isnanl(y)) return z; + if(x==0.0&&y==0.0) { + return __kernel_standard(y,x,203); /* atan2l(+-0,+-0) */ + } else + return z; +#endif +} +weak_alias (__atan2l, atan2l) diff --git a/sysdeps/libm-ieee754/w_atanhl.c b/sysdeps/libm-ieee754/w_atanhl.c new file mode 100644 index 0000000000..d675fc6fe7 --- /dev/null +++ b/sysdeps/libm-ieee754/w_atanhl.c @@ -0,0 +1,52 @@ +/* w_atanhl.c -- long double version of w_atanh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper atanhl(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __atanhl(long double x) /* wrapper atanhl */ +#else + long double __atanhl(x) /* wrapper atanhl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atanhl(x); +#else + long double z,y; + z = __ieee754_atanhl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + y = fabsl(x); + if(y>=1.0) { + if(y>1.0) + return __kernel_standard(x,x,230); /* atanhl(|x|>1) */ + else + return __kernel_standard(x,x,231); /* atanhl(|x|==1) */ + } else + return z; +#endif +} +weak_alias (__atanhl, atanhl) diff --git a/sysdeps/libm-ieee754/w_cabsl.c b/sysdeps/libm-ieee754/w_cabsl.c new file mode 100644 index 0000000000..e82130d46d --- /dev/null +++ b/sysdeps/libm-ieee754/w_cabsl.c @@ -0,0 +1,18 @@ +/* + * cabsl() wrapper for hypotl(). + * + * Written by J.T. Conklin, <jtc@wimsey.com> + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + * Placed into the Public Domain, 1994. + */ + +#include <math.h> + +long double +__cabsl(z) + struct __cabsl_complex z; +{ + return __hypotl(z.x, z.y); +} +weak_alias (__cabsl, cabsl) diff --git a/sysdeps/libm-ieee754/w_coshl.c b/sysdeps/libm-ieee754/w_coshl.c new file mode 100644 index 0000000000..343d5724b9 --- /dev/null +++ b/sysdeps/libm-ieee754/w_coshl.c @@ -0,0 +1,47 @@ +/* w_acoshl.c -- long double version of w_acosh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper coshl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __coshl(long double x) /* wrapper coshl */ +#else + long double __coshl(x) /* wrapper coshl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_coshl(x); +#else + long double z; + z = __ieee754_coshl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(fabsl(x)>7.10475860073943863426e+02) { + return __kernel_standard(x,x,205); /* cosh overflow */ + } else + return z; +#endif +} +weak_alias (__coshl, coshl) diff --git a/sysdeps/libm-ieee754/w_dreml.c b/sysdeps/libm-ieee754/w_dreml.c new file mode 100644 index 0000000000..aa73eedc49 --- /dev/null +++ b/sysdeps/libm-ieee754/w_dreml.c @@ -0,0 +1,18 @@ +/* + * dreml() wrapper for remainderl(). + * + * Written by J.T. Conklin, <jtc@wimsey.com> + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + * Placed into the Public Domain, 1994. + */ + +#include <math.h> + +long double +__dreml(x, y) + long double x, y; +{ + return __remainderl(x, y); +} +weak_alias (__dreml, dreml) diff --git a/sysdeps/libm-ieee754/w_expl.c b/sysdeps/libm-ieee754/w_expl.c new file mode 100644 index 0000000000..b8152cea65 --- /dev/null +++ b/sysdeps/libm-ieee754/w_expl.c @@ -0,0 +1,60 @@ +/* w_expl.c -- long double version of w_exp.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper expl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +o_threshold= 1.135652340629414394949193107797076489134e4, + /* 0x400C, 0xB17217F7, 0xD1CF79AC */ +u_threshold= -1.140019167866942050398521670162263001513e4; + /* 0x400C, 0xB220C447, 0x69C201E8 */ + +#ifdef __STDC__ + long double __expl(long double x) /* wrapper exp */ +#else + long double __expl(x) /* wrapper exp */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_expl(x); +#else + long double z; + z = __ieee754_expl(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitel(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,206); /* exp overflow */ + else if(x<u_threshold) + return __kernel_standard(x,x,207); /* exp underflow */ + } + return z; +#endif +} +weak_alias (__expl, expl) diff --git a/sysdeps/libm-ieee754/w_fmodl.c b/sysdeps/libm-ieee754/w_fmodl.c new file mode 100644 index 0000000000..71ed4a94a4 --- /dev/null +++ b/sysdeps/libm-ieee754/w_fmodl.c @@ -0,0 +1,48 @@ +/* w_fmodl.c -- long double version of w_fmod.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper fmodl(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __fmodl(long double x, long double y)/* wrapper fmodl */ +#else + long double __fmodl(x,y) /* wrapper fmodl */ + long double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_fmodl(x,y); +#else + long double z; + z = __ieee754_fmodl(x,y); + if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z; + if(y==0.0) { + return __kernel_standard(x,y,227); /* fmod(x,0) */ + } else + return z; +#endif +} +weak_alias (__fmodl, fmodl) diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c new file mode 100644 index 0000000000..f72e2e7e44 --- /dev/null +++ b/sysdeps/libm-ieee754/w_gammal.c @@ -0,0 +1,54 @@ +/* w_gammal.c -- long double version of w_gamma.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* long double gammal(double x) + * Return the logarithm of the Gamma function of x. + * + * Method: call gammal_r + */ + +#include "math.h" +#include "math_private.h" + +extern int signgam; + +#ifdef __STDC__ + long double __gammal(long double x) +#else + long double __gammal(x) + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammal_r(x,&signgam); +#else + long double y; + y = __ieee754_lgammal_r(x,&signgam); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,241); /* gamma pole */ + else + return __kernel_standard(x,x,240); /* gamma overflow */ + } else + return y; +#endif +} +weak_alias (__gammal, gammal) diff --git a/sysdeps/libm-ieee754/w_gammal_r.c b/sysdeps/libm-ieee754/w_gammal_r.c new file mode 100644 index 0000000000..ad6a43ae9b --- /dev/null +++ b/sysdeps/libm-ieee754/w_gammal_r.c @@ -0,0 +1,52 @@ +/* w_gammal_r.c -- long double version of w_gamma_r.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper long double gammal_r(long double x, int *signgamp) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __gammal_r(long double x, int *signgamp) + /* wrapper lgammal_r */ +#else + long double __gammal_r(x,signgamp) /* wrapper lgamma_r */ + long double x; int *signgamp; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammal_r(x,signgamp); +#else + long double y; + y = __ieee754_lgammal_r(x,signgamp); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,241); /* gamma pole */ + else + return __kernel_standard(x,x,240); /* gamma overflow */ + } else + return y; +#endif +} +weak_alias (__gammal_r, gammal_r) diff --git a/sysdeps/libm-ieee754/w_hypotl.c b/sysdeps/libm-ieee754/w_hypotl.c new file mode 100644 index 0000000000..9f92e950d6 --- /dev/null +++ b/sysdeps/libm-ieee754/w_hypotl.c @@ -0,0 +1,48 @@ +/* w_hypotl.c -- long double version of w_hypot.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper hypotl(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __hypotl(longdouble x, long double y)/* wrapper hypotl */ +#else + long double __hypotl(x,y) /* wrapper hypotl */ + long double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_hypotl(x,y); +#else + long double z; + z = __ieee754_hypotl(x,y); + if(_LIB_VERSION == _IEEE_) return z; + if((!__finitel(z))&&__finitel(x)&&__finitel(y)) + return __kernel_standard(x,y,204); /* hypot overflow */ + else + return z; +#endif +} +weak_alias (__hypotl, hypotl) diff --git a/sysdeps/libm-ieee754/w_j0l.c b/sysdeps/libm-ieee754/w_j0l.c new file mode 100644 index 0000000000..7b4144c95e --- /dev/null +++ b/sysdeps/libm-ieee754/w_j0l.c @@ -0,0 +1,75 @@ +/* w_j0l.c -- long double version of w_j0.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper j0l(long double x), y0l(long double x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __j0l(long double x) /* wrapper j0l */ +#else + long double __j0l(x) /* wrapper j0 */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j0l(x); +#else + long double z = __ieee754_j0l(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(fabsl(x)>X_TLOSS) { + return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */ + } else + return z; +#endif +} +weak_alias (__j0l, j0l) + +#ifdef __STDC__ + long double __y0l(long double x) /* wrapper y0l */ +#else + long double __y0l(x) /* wrapper y0 */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y0l(x); +#else + long double z; + z = __ieee754_y0l(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,208); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,209); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */ + } else + return z; +#endif +} +weak_alias (__y0l, y0l) diff --git a/sysdeps/libm-ieee754/w_j1l.c b/sysdeps/libm-ieee754/w_j1l.c new file mode 100644 index 0000000000..223ab79cde --- /dev/null +++ b/sysdeps/libm-ieee754/w_j1l.c @@ -0,0 +1,76 @@ +/* w_j1l.c -- long double version of w_j1.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper of j1l,y1l + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __j1l(long double x) /* wrapper j1l */ +#else + long double __j1l(x) /* wrapper j1l */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j1l(x); +#else + long double z; + z = __ieee754_j1l(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(fabsl(x)>X_TLOSS) { + return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */ + } else + return z; +#endif +} +weak_alias (__j1l, j1l) + +#ifdef __STDC__ + long double __y1l(long double x) /* wrapper y1l */ +#else + long double __y1l(x) /* wrapper y1l */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y1l(x); +#else + long double z; + z = __ieee754_y1l(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,210); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,211); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */ + } else + return z; +#endif +} +weak_alias (__y1l, y1l) diff --git a/sysdeps/libm-ieee754/w_jnl.c b/sysdeps/libm-ieee754/w_jnl.c new file mode 100644 index 0000000000..0a243db30a --- /dev/null +++ b/sysdeps/libm-ieee754/w_jnl.c @@ -0,0 +1,98 @@ +/* w_jnl.c -- long double version of w_jn.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper jn(int n, double x), yn(int n, double x) + * floating point Bessel's function of the 1st and 2nd kind + * of order n + * + * Special cases: + * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; + * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. + * Note 2. About jn(n,x), yn(n,x) + * For n=0, j0(x) is called, + * for n=1, j1(x) is called, + * for n<x, forward recursion us used starting + * from values of j0(x) and j1(x). + * for n>x, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __jnl(int n, long double x) /* wrapper jnl */ +#else + long double __jnl(n,x) /* wrapper jnl */ + long double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_jnl(n,x); +#else + long double z; + z = __ieee754_jnl(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(fabsl(x)>X_TLOSS) { + return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ + } else + return z; +#endif +} +weak_alias (__jnl, jnl) + +#ifdef __STDC__ + long double __ynl(int n, long double x) /* wrapper ynl */ +#else + long double __ynl(n,x) /* wrapper ynl */ + long double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_ynl(n,x); +#else + long double z; + z = __ieee754_ynl(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard((double)n,x,212); + else + /* d = zero/(x-x); */ + return __kernel_standard((double)n,x,213); + } + if(x>X_TLOSS) { + return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */ + } else + return z; +#endif +} +weak_alias (__ynl, ynl) diff --git a/sysdeps/libm-ieee754/w_lgammal.c b/sysdeps/libm-ieee754/w_lgammal.c new file mode 100644 index 0000000000..3d2cdbbc30 --- /dev/null +++ b/sysdeps/libm-ieee754/w_lgammal.c @@ -0,0 +1,54 @@ +/* w_lgammal.c -- long double version of w_lgamma.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* long double lgammal(long double x) + * Return the logarithm of the Gamma function of x. + * + * Method: call __ieee754_lgammal_r + */ + +#include "math.h" +#include "math_private.h" + +extern int signgam; + +#ifdef __STDC__ + long double __lgammal(long double x) +#else + long double __lgammal(x) + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammal_r(x,&signgam); +#else + long double y; + y = __ieee754_lgammal_r(x,&signgam); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,215); /* lgamma pole */ + else + return __kernel_standard(x,x,214); /* lgamma overflow */ + } else + return y; +#endif +} +weak_alias (__lgammal, lgammal) diff --git a/sysdeps/libm-ieee754/w_lgammal_r.c b/sysdeps/libm-ieee754/w_lgammal_r.c new file mode 100644 index 0000000000..71f5c005d0 --- /dev/null +++ b/sysdeps/libm-ieee754/w_lgammal_r.c @@ -0,0 +1,52 @@ +/* w_lgammal_r.c -- long double version of w_lgamma_r.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper long double lgammal_r(long double x, int *signgamp) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __lgammal_r(long double x, int *signgamp) + /* wrapper lgamma_r */ +#else + long double __lgammal_r(x,signgamp) /* wrapper lgamma_r */ + long double x; int *signgamp; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammal_r(x,signgamp); +#else + long double y; + y = __ieee754_lgammal_r(x,signgamp); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,215); /* lgamma pole */ + else + return __kernel_standard(x,x,214); /* lgamma overflow */ + } else + return y; +#endif +} +weak_alias (__lgammal_r, lgammal_r) diff --git a/sysdeps/libm-ieee754/w_log10l.c b/sysdeps/libm-ieee754/w_log10l.c new file mode 100644 index 0000000000..0d0861689d --- /dev/null +++ b/sysdeps/libm-ieee754/w_log10l.c @@ -0,0 +1,51 @@ +/* w_log10l.c -- long double version of w_log10.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper log10l(X) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __log10l(long double x) /* wrapper log10l */ +#else + long double __log10l(x) /* wrapper log10l */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_log10l(x); +#else + long double z; + z = __ieee754_log10l(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(x<=0.0) { + if(x==0.0) + return __kernel_standard(x,x,218); /* log10(0) */ + else + return __kernel_standard(x,x,219); /* log10(x<0) */ + } else + return z; +#endif +} +weak_alias (__log10l, log10l) diff --git a/sysdeps/libm-ieee754/w_logl.c b/sysdeps/libm-ieee754/w_logl.c new file mode 100644 index 0000000000..bb979c26c3 --- /dev/null +++ b/sysdeps/libm-ieee754/w_logl.c @@ -0,0 +1,48 @@ +/* w_logl.c -- long double version of w_log.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper logl(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __logl(long double x) /* wrapper logl */ +#else + long double __logl(x) /* wrapper logl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_logl(x); +#else + long double z; + z = __ieee754_logl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z; + if(x==0.0) + return __kernel_standard(x,x,216); /* log(0) */ + else + return __kernel_standard(x,x,217); /* log(x<0) */ +#endif +} +weak_alias (__logl, logl) diff --git a/sysdeps/libm-ieee754/w_powl.c b/sysdeps/libm-ieee754/w_powl.c new file mode 100644 index 0000000000..019664e0f1 --- /dev/null +++ b/sysdeps/libm-ieee754/w_powl.c @@ -0,0 +1,64 @@ +/* w_powl.c -- long double version of w_pow.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper powl(x,y) return x**y + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + long double __powl(long double x, long double y)/* wrapper powl */ +#else + long double __powl(x,y) /* wrapper powl */ + long double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_powl(x,y); +#else + long double z; + z=__ieee754_powl(x,y); + if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z; + if(__isnanl(x)) { + if(y==0.0) + return __kernel_standard(x,y,242); /* pow(NaN,0.0) */ + else + return z; + } + if(x==0.0){ + if(y==0.0) + return __kernel_standard(x,y,220); /* pow(0.0,0.0) */ + if(__finite(y)&&y<0.0) + return __kernel_standard(x,y,223); /* pow(0.0,negative) */ + return z; + } + if(!__finitel(z)) { + if(__finitel(x)&&__finitel(y)) { + if(__isnanl(z)) + return __kernel_standard(x,y,224); /* pow neg**non-int */ + else + return __kernel_standard(x,y,221); /* pow overflow */ + } + } + if(z==0.0&&__finitel(x)&&__finitel(y)) + return __kernel_standard(x,y,222); /* pow underflow */ + return z; +#endif +} +weak_alias (__powl, powl) diff --git a/sysdeps/libm-ieee754/w_remainderl.c b/sysdeps/libm-ieee754/w_remainderl.c new file mode 100644 index 0000000000..284140174d --- /dev/null +++ b/sysdeps/libm-ieee754/w_remainderl.c @@ -0,0 +1,48 @@ +/* w_remainderl.c -- long double version of w_remainder.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper remainderl(x,p) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __remainderl(long double x, long double y) + /* wrapper remainderl */ +#else + long double __remainderl(x,y) /* wrapper remainder */ + long double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_remainderl(x,y); +#else + long double z; + z = __ieee754_remainderl(x,y); + if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z; + if(y==0.0) + return __kernel_standard(x,y,228); /* remainder(x,0) */ + else + return z; +#endif +} +weak_alias (__remainderl, remainderl) diff --git a/sysdeps/libm-ieee754/w_scalbl.c b/sysdeps/libm-ieee754/w_scalbl.c new file mode 100644 index 0000000000..ff5117d24c --- /dev/null +++ b/sysdeps/libm-ieee754/w_scalbl.c @@ -0,0 +1,65 @@ +/* w_scalbl.c -- long double version of w_scalb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper scalbl(long double x, long double fn) is provide for + * passing various standard test suite. One + * should use scalbnl() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include <errno.h> + +#ifdef __STDC__ +#ifdef _SCALB_INT + long double __scalbl(long double x, int fn) /* wrapper scalbl */ +#else + long double __scalbl(long double x, long double fn)/* wrapper scalbl */ +#endif +#else + long double __scalbl(x,fn) /* wrapper scalbl */ +#ifdef _SCALB_INT + long double x; int fn; +#else + long double x,fn; +#endif +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_scalbl(x,fn); +#else + long double z; + z = __ieee754_scalbl(x,fn); + if(_LIB_VERSION == _IEEE_) return z; + if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) { + return __kernel_standard(x,(double)fn,232); /* scalb overflow */ + } + if(z==0.0&&z!=x) { + return __kernel_standard(x,(double)fn,233); /* scalb underflow */ + } +#ifndef _SCALB_INT + if(!__finitel(fn)) errno = ERANGE; +#endif + return z; +#endif +} +weak_alias (__scalbl, scalbl) diff --git a/sysdeps/libm-ieee754/w_sinhl.c b/sysdeps/libm-ieee754/w_sinhl.c new file mode 100644 index 0000000000..3e93cc598d --- /dev/null +++ b/sysdeps/libm-ieee754/w_sinhl.c @@ -0,0 +1,47 @@ +/* w_sinhl.c -- long double version of w_sinh.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper sinhl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __sinhl(long double x) /* wrapper sinhl */ +#else + long double __sinhl(x) /* wrapper sinhl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sinhl(x); +#else + long double z; + z = __ieee754_sinhl(x); + if(_LIB_VERSION == _IEEE_) return z; + if(!__finitel(z)&&__finitel(x)) { + return __kernel_standard(x,x,225); /* sinh overflow */ + } else + return z; +#endif +} +weak_alias (__sinhl, sinhl) diff --git a/sysdeps/libm-ieee754/w_sqrtl.c b/sysdeps/libm-ieee754/w_sqrtl.c new file mode 100644 index 0000000000..5873ce93ab --- /dev/null +++ b/sysdeps/libm-ieee754/w_sqrtl.c @@ -0,0 +1,47 @@ +/* w_sqrtl.c -- long double version of w_sqrt.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * wrapper sqrtl(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __sqrtl(long double x) /* wrapper sqrtl */ +#else + long double __sqrtl(x) /* wrapper sqrtl */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sqrtl(x); +#else + long double z; + z = __ieee754_sqrtl(x); + if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z; + if(x<0.0) { + return __kernel_standard(x,x,226); /* sqrt(negative) */ + } else + return z; +#endif +} +weak_alias (__sqrtl, sqrtl) |