diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-07-14 00:54:57 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-07-14 00:54:57 +0000 |
commit | abfbdde177c3a7155070dda1b2cdc8292054cc26 (patch) | |
tree | e021306b596381fbf8311d2b7eb294e918ff17c8 /math | |
parent | 86421aa57ecfd70963ae66848bd6a6dd3b8e0fe6 (diff) | |
download | glibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.tar.gz glibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.tar.xz glibc-abfbdde177c3a7155070dda1b2cdc8292054cc26.zip |
Update.
Diffstat (limited to 'math')
74 files changed, 3821 insertions, 100 deletions
diff --git a/math/machine/endian.h b/math/machine/endian.h deleted file mode 100644 index 88804564bf..0000000000 --- a/math/machine/endian.h +++ /dev/null @@ -1,4 +0,0 @@ -/* math_private.h wants to include <machine/endian.h>; we provide this - file so it can, leaving math_private.h unmodified from the original. */ - -#include <endian.h> diff --git a/math/math_private.h b/math/math_private.h index 906b1dabba..35e3e4e7ca 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -17,7 +17,7 @@ #ifndef _MATH_PRIVATE_H_ #define _MATH_PRIVATE_H_ -#include <machine/endian.h> +#include <endian.h> #include <sys/types.h> /* The original fdlibm code used statements like: @@ -147,101 +147,8 @@ do { \ (d) = sf_u.value; \ } while (0) -/* A union which permits us to convert between a long double and - three 32 bit ints. */ - -#if __FLOAT_WORD_ORDER == BIG_ENDIAN - -typedef union -{ - long double value; - struct - { - unsigned int sign_exponent:16; - unsigned int empty:16; - u_int32_t msw; - u_int32_t lsw; - } parts; -} ieee_long_double_shape_type; - -#endif - -#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN - -typedef union -{ - long double value; - struct - { - u_int32_t lsw; - u_int32_t msw; - unsigned int sign_exponent:16; - unsigned int empty:16; - } parts; -} ieee_long_double_shape_type; - -#endif - -/* Get three 32 bit ints from a double. */ - -#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ -do { \ - ieee_long_double_shape_type ew_u; \ - ew_u.value = (d); \ - (exp) = ew_u.parts.sign_exponent; \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -/* Set a double from two 32 bit ints. */ - -#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ -do { \ - ieee_long_double_shape_type iw_u; \ - iw_u.parts.sign_exponent = (exp); \ - iw_u.parts.msw = (ix0); \ - iw_u.parts.lsw = (ix1); \ - (d) = iw_u.value; \ -} while (0) - -/* Get the more significant 32 bits of a long double mantissa. */ - -#define GET_LDOUBLE_MSW(v,d) \ -do { \ - ieee_long_double_shape_type sh_u; \ - sh_u.value = (d); \ - (v) = sh_u.parts.msw; \ -} while (0) - -/* Set the more significant 32 bits of a long double mantissa from an int. */ - -#define SET_LDOUBLE_MSW(d,v) \ -do { \ - ieee_long_double_shape_type sh_u; \ - sh_u.value = (d); \ - sh_u.parts.msw = (v); \ - (d) = sh_u.value; \ -} while (0) - -/* Get int from the exponent of a long double. */ - -#define GET_LDOUBLE_EXP(exp,d) \ -do { \ - ieee_long_double_shape_type ge_u; \ - ge_u.value = (d); \ - (exp) = ge_u.parts.sign_exponent; \ -} while (0) - -/* Set exponent of a long double from an int. */ - -#define SET_LDOUBLE_EXP(d,exp) \ -do { \ - ieee_long_double_shape_type se_u; \ - se_u.value = (d); \ - se_u.parts.sign_exponent = (exp); \ - (d) = se_u.value; \ -} while (0) - +/* Get long double macros from a separate header. */ +#include <math_ldbl.h> /* ieee style elementary functions */ extern double __ieee754_sqrt __P((double)); diff --git a/math/w_acos.c b/math/w_acos.c new file mode 100644 index 0000000000..5a1158ea7a --- /dev/null +++ b/math/w_acos.c @@ -0,0 +1,48 @@ +/* @(#)w_acos.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $"; +#endif + +/* + * wrap_acos(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __acos(double x) /* wrapper acos */ +#else + double __acos(x) /* wrapper acos */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acos(x); +#else + double z; + z = __ieee754_acos(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(fabs(x)>1.0) { + return __kernel_standard(x,x,1); /* acos(|x|>1) */ + } else + return z; +#endif +} +weak_alias (__acos, acos) +#ifdef NO_LONG_DOUBLE +strong_alias (__acos, __acosl) +weak_alias (__acos, acosl) +#endif diff --git a/math/w_acosf.c b/math/w_acosf.c new file mode 100644 index 0000000000..28260ddd3e --- /dev/null +++ b/math/w_acosf.c @@ -0,0 +1,48 @@ +/* w_acosf.c -- float version of w_acos.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_acosf.c,v 1.3 1995/05/10 20:48:29 jtc Exp $"; +#endif + +/* + * wrap_acosf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __acosf(float x) /* wrapper acosf */ +#else + float __acosf(x) /* wrapper acosf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acosf(x); +#else + float z; + z = __ieee754_acosf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(fabsf(x)>(float)1.0) { + /* acosf(|x|>1) */ + return (float)__kernel_standard((double)x,(double)x,101); + } else + return z; +#endif +} +weak_alias (__acosf, acosf) diff --git a/math/w_acosh.c b/math/w_acosh.c new file mode 100644 index 0000000000..2b5d60f7ea --- /dev/null +++ b/math/w_acosh.c @@ -0,0 +1,47 @@ +/* @(#)w_acosh.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $"; +#endif + +/* + * wrapper acosh(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __acosh(double x) /* wrapper acosh */ +#else + double __acosh(x) /* wrapper acosh */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acosh(x); +#else + double z; + z = __ieee754_acosh(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(x<1.0) { + return __kernel_standard(x,x,29); /* acosh(x<1) */ + } else + return z; +#endif +} +weak_alias (__acosh, acosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__acosh, __acoshl) +weak_alias (__acosh, acoshl) +#endif diff --git a/math/w_acoshf.c b/math/w_acoshf.c new file mode 100644 index 0000000000..f701983dc2 --- /dev/null +++ b/math/w_acoshf.c @@ -0,0 +1,48 @@ +/* w_acoshf.c -- float version of w_acosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_acoshf.c,v 1.3 1995/05/10 20:48:33 jtc Exp $"; +#endif + +/* + * wrapper acoshf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __acoshf(float x) /* wrapper acoshf */ +#else + float __acoshf(x) /* wrapper acoshf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_acoshf(x); +#else + float z; + z = __ieee754_acoshf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(x<(float)1.0) { + /* acosh(x<1) */ + return (float)__kernel_standard((double)x,(double)x,129); + } else + return z; +#endif +} +weak_alias (__acoshf, acoshf) diff --git a/math/w_acoshl.c b/math/w_acoshl.c new file mode 100644 index 0000000000..a37d4c15d9 --- /dev/null +++ b/math/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/math/w_acosl.c b/math/w_acosl.c new file mode 100644 index 0000000000..cd9cecf2f9 --- /dev/null +++ b/math/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/math/w_asin.c b/math/w_asin.c new file mode 100644 index 0000000000..a7ca4ef9fd --- /dev/null +++ b/math/w_asin.c @@ -0,0 +1,49 @@ +/* @(#)w_asin.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $"; +#endif + +/* + * wrapper asin(x) + */ + + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __asin(double x) /* wrapper asin */ +#else + double __asin(x) /* wrapper asin */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_asin(x); +#else + double z; + z = __ieee754_asin(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(fabs(x)>1.0) { + return __kernel_standard(x,x,2); /* asin(|x|>1) */ + } else + return z; +#endif +} +weak_alias (__asin, asin) +#ifdef NO_LONG_DOUBLE +strong_alias (__asin, __asinl) +weak_alias (__asin, asinl) +#endif diff --git a/math/w_asinf.c b/math/w_asinf.c new file mode 100644 index 0000000000..d7f7a253b0 --- /dev/null +++ b/math/w_asinf.c @@ -0,0 +1,49 @@ +/* w_asinf.c -- float version of w_asin.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_asinf.c,v 1.3 1995/05/10 20:48:37 jtc Exp $"; +#endif + +/* + * wrapper asinf(x) + */ + + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __asinf(float x) /* wrapper asinf */ +#else + float __asinf(x) /* wrapper asinf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_asinf(x); +#else + float z; + z = __ieee754_asinf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(fabsf(x)>(float)1.0) { + /* asinf(|x|>1) */ + return (float)__kernel_standard((double)x,(double)x,102); + } else + return z; +#endif +} +weak_alias (__asinf, asinf) diff --git a/math/w_asinl.c b/math/w_asinl.c new file mode 100644 index 0000000000..0ac3038e95 --- /dev/null +++ b/math/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/math/w_atan2.c b/math/w_atan2.c new file mode 100644 index 0000000000..801baa2347 --- /dev/null +++ b/math/w_atan2.c @@ -0,0 +1,47 @@ +/* @(#)w_atan2.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $"; +#endif + +/* + * wrapper atan2(y,x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __atan2(double y, double x) /* wrapper atan2 */ +#else + double __atan2(y,x) /* wrapper atan2 */ + double y,x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atan2(y,x); +#else + double z; + z = __ieee754_atan2(y,x); + if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z; + if(x==0.0&&y==0.0) + return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */ + return z; +#endif +} +weak_alias (__atan2, atan2) +#ifdef NO_LONG_DOUBLE +strong_alias (__atan2, __atan2l) +weak_alias (__atan2, atan2l) +#endif diff --git a/math/w_atan2f.c b/math/w_atan2f.c new file mode 100644 index 0000000000..09caa06f00 --- /dev/null +++ b/math/w_atan2f.c @@ -0,0 +1,46 @@ +/* w_atan2f.c -- float version of w_atan2.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $"; +#endif + +/* + * wrapper atan2f(y,x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __atan2f(float y, float x) /* wrapper atan2f */ +#else + float __atan2f(y,x) /* wrapper atan2 */ + float y,x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atan2f(y,x); +#else + float z; + z = __ieee754_atan2f(y,x); + if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z; + if(x==0.0&&y==0.0) + return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */ + return z; +#endif +} +weak_alias (__atan2f, atan2f) diff --git a/math/w_atan2l.c b/math/w_atan2l.c new file mode 100644 index 0000000000..2897c8c5f9 --- /dev/null +++ b/math/w_atan2l.c @@ -0,0 +1,47 @@ +/* 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 != _SVID_||__isnanl(x)||__isnanl(y)) return z; + if(x==0.0&&y==0.0) + return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */ + return z; +#endif +} +weak_alias (__atan2l, atan2l) diff --git a/math/w_atanh.c b/math/w_atanh.c new file mode 100644 index 0000000000..e7995b1830 --- /dev/null +++ b/math/w_atanh.c @@ -0,0 +1,52 @@ +/* @(#)w_atanh.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $"; +#endif + +/* + * wrapper atanh(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __atanh(double x) /* wrapper atanh */ +#else + double __atanh(x) /* wrapper atanh */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atanh(x); +#else + double z,y; + z = __ieee754_atanh(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + y = fabs(x); + if(y>=1.0) { + if(y>1.0) + return __kernel_standard(x,x,30); /* atanh(|x|>1) */ + else + return __kernel_standard(x,x,31); /* atanh(|x|==1) */ + } else + return z; +#endif +} +weak_alias (__atanh, atanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__atanh, __atanhl) +weak_alias (__atanh, atanhl) +#endif diff --git a/math/w_atanhf.c b/math/w_atanhf.c new file mode 100644 index 0000000000..0b24f2c71a --- /dev/null +++ b/math/w_atanhf.c @@ -0,0 +1,53 @@ +/* w_atanhf.c -- float version of w_atanh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_atanhf.c,v 1.3 1995/05/10 20:48:45 jtc Exp $"; +#endif + +/* + * wrapper atanhf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __atanhf(float x) /* wrapper atanhf */ +#else + float __atanhf(x) /* wrapper atanhf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_atanhf(x); +#else + float z,y; + z = __ieee754_atanhf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + y = fabsf(x); + if(y>=(float)1.0) { + if(y>(float)1.0) + /* atanhf(|x|>1) */ + return (float)__kernel_standard((double)x,(double)x,130); + else + /* atanhf(|x|==1) */ + return (float)__kernel_standard((double)x,(double)x,131); + } else + return z; +#endif +} +weak_alias (__atanhf, atanhf) diff --git a/math/w_atanhl.c b/math/w_atanhl.c new file mode 100644 index 0000000000..d675fc6fe7 --- /dev/null +++ b/math/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/math/w_cosh.c b/math/w_cosh.c new file mode 100644 index 0000000000..8db25c868c --- /dev/null +++ b/math/w_cosh.c @@ -0,0 +1,47 @@ +/* @(#)w_cosh.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $"; +#endif + +/* + * wrapper cosh(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __cosh(double x) /* wrapper cosh */ +#else + double __cosh(x) /* wrapper cosh */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_cosh(x); +#else + double z; + z = __ieee754_cosh(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(fabs(x)>7.10475860073943863426e+02) { + return __kernel_standard(x,x,5); /* cosh overflow */ + } else + return z; +#endif +} +weak_alias (__cosh, cosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__cosh, __coshl) +weak_alias (__cosh, coshl) +#endif diff --git a/math/w_coshf.c b/math/w_coshf.c new file mode 100644 index 0000000000..53ca84108e --- /dev/null +++ b/math/w_coshf.c @@ -0,0 +1,47 @@ +/* w_coshf.c -- float version of w_cosh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_coshf.c,v 1.3 1995/05/10 20:48:49 jtc Exp $"; +#endif + +/* + * wrapper coshf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __coshf(float x) /* wrapper coshf */ +#else + float __coshf(x) /* wrapper coshf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_coshf(x); +#else + float z; + z = __ieee754_coshf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(fabsf(x)>(float)8.9415985107e+01) { + /* cosh overflow */ + return (float)__kernel_standard((double)x,(double)x,105); + } else + return z; +#endif +} +weak_alias (__coshf, coshf) diff --git a/math/w_coshl.c b/math/w_coshl.c new file mode 100644 index 0000000000..343d5724b9 --- /dev/null +++ b/math/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/math/w_drem.c b/math/w_drem.c new file mode 100644 index 0000000000..9e2b1e7472 --- /dev/null +++ b/math/w_drem.c @@ -0,0 +1,20 @@ +/* + * drem() wrapper for remainder(). + * + * Written by J.T. Conklin, <jtc@wimsey.com> + * Placed into the Public Domain, 1994. + */ + +#include <math.h> + +double +__drem(x, y) + double x, y; +{ + return __remainder(x, y); +} +weak_alias (__drem, drem) +#ifdef NO_LONG_DOUBLE +strong_alias (__drem, __dreml) +weak_alias (__drem, dreml) +#endif diff --git a/math/w_dremf.c b/math/w_dremf.c new file mode 100644 index 0000000000..b740ea304c --- /dev/null +++ b/math/w_dremf.c @@ -0,0 +1,17 @@ +/* + * dremf() wrapper for remainderf(). + * + * Written by J.T. Conklin, <jtc@wimsey.com> + * Placed into the Public Domain, 1994. + */ + +#include "math.h" +#include "math_private.h" + +float +__dremf(x, y) + float x, y; +{ + return __remainderf(x, y); +} +weak_alias (__dremf, dremf) diff --git a/math/w_dreml.c b/math/w_dreml.c new file mode 100644 index 0000000000..aa73eedc49 --- /dev/null +++ b/math/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/math/w_exp10.c b/math/w_exp10.c new file mode 100644 index 0000000000..bf0d361f52 --- /dev/null +++ b/math/w_exp10.c @@ -0,0 +1,61 @@ +/* @(#)w_exp10.c + * Conversion to exp10 by Ulrich Drepper <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 exp10(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +o_threshold= 3.0825471555991674389672e+02, +u_threshold= -3.2360724533877978485251e+02; + +#ifdef __STDC__ + double __exp10(double x) /* wrapper exp10 */ +#else + double __exp10(x) /* wrapper exp10 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10(x); +#else + double z; + z = __ieee754_exp10(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finite(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,46); /* exp10 overflow */ + else if(x<u_threshold) + return __kernel_standard(x,x,47); /* exp10 underflow */ + } + return z; +#endif +} +weak_alias (__exp10, exp10) +strong_alias (__exp10, __pow10) +weak_alias (__pow10, pow10) +#ifdef NO_LONG_DOUBLE +strong_alias (__exp10, __exp10l) +weak_alias (__exp10, exp10l) +strong_alias (__exp10l, __pow10l) +weak_alias (__pow10l, pow10l) +#endif diff --git a/math/w_exp10f.c b/math/w_exp10f.c new file mode 100644 index 0000000000..f78be7973b --- /dev/null +++ b/math/w_exp10f.c @@ -0,0 +1,57 @@ +/* w_exp10f.c -- float version of w_exp10.c. + * Conversion to exp10 by Ulrich Drepper <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 expf10(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +o_threshold= 3.853183944498959298709e+01, +u_threshold= -4.515449934959717928174e+01; + +#ifdef __STDC__ + float __exp10f(float x) /* wrapper exp10f */ +#else + float __exp10f(x) /* wrapper exp10f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10f(x); +#else + float z; + z = __ieee754_exp10f(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitef(x)) { + if(x>o_threshold) + /* exp overflow */ + return (float)__kernel_standard((double)x,(double)x,146); + else if(x<u_threshold) + /* exp underflow */ + return (float)__kernel_standard((double)x,(double)x,147); + } + return z; +#endif +} +weak_alias (__exp10f, exp10f) +strong_alias (__exp10f, __pow10f) +weak_alias (__pow10f, pow10f) diff --git a/math/w_exp10l.c b/math/w_exp10l.c new file mode 100644 index 0000000000..7117873c22 --- /dev/null +++ b/math/w_exp10l.c @@ -0,0 +1,56 @@ +/* w_exp10l.c -- long double version of w_exp10.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 exp10l(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +o_threshold= 4.93207544895866790234755e+03, +u_threshold= -4.95104033868549871764588e+03; + +#ifdef __STDC__ + long double __exp10l(long double x) /* wrapper exp10 */ +#else + long double __exp10l(x) /* wrapper exp10 */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10l(x); +#else + long double z; + z = __ieee754_exp10l(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitel(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,246); /* exp10 overflow */ + else if(x<u_threshold) + return __kernel_standard(x,x,247); /* exp10 underflow */ + } + return z; +#endif +} +weak_alias (__exp10l, exp10l) +strong_alias (__exp10l, __pow10l) +weak_alias (__pow10l, pow10l) diff --git a/math/w_exp2.c b/math/w_exp2.c new file mode 100644 index 0000000000..126aa090bc --- /dev/null +++ b/math/w_exp2.c @@ -0,0 +1,36 @@ +/* + * wrapper exp2(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const double o_threshold= (double) DBL_MAX_EXP; +static const double u_threshold= (double) DBL_MIN_EXP; + +double +__exp2 (double x) /* wrapper exp2 */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2 (x); +#else + double z; + z = __ieee754_exp2 (x); + if (_LIB_VERSION != _IEEE_ && __finite (x)) + { + if (x > o_threshold) + /* exp2 overflow */ + return __kernel_standard (x, x, 44); + else if (x < u_threshold) + /* exp2 underflow */ + return __kernel_standard (x, x, 45); + } + return z; +#endif +} +weak_alias (__exp2, exp2) +#ifdef NO_LONG_DOUBLE +strong_alias (__exp2, __expl2) +weak_alias (__exp2, expl2) +#endif diff --git a/math/w_exp2f.c b/math/w_exp2f.c new file mode 100644 index 0000000000..d2c340db3f --- /dev/null +++ b/math/w_exp2f.c @@ -0,0 +1,32 @@ +/* + * wrapper exp2f(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const float o_threshold= (float) FLT_MAX_EXP; +static const float u_threshold= (float) FLT_MIN_EXP; + +float +__exp2f (float x) /* wrapper exp2f */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2f (x); +#else + float z; + z = __ieee754_exp2f (x); + if (_LIB_VERSION != _IEEE_ && __finitef (x)) + { + if (x > o_threshold) + /* exp2 overflow */ + return (float) __kernel_standard ((double) x, (double) x, 144); + else if (x < u_threshold) + /* exp2 underflow */ + return (float) __kernel_standard ((double) x, (double) x, 145); + } + return z; +#endif +} +weak_alias (__exp2f, exp2f) diff --git a/math/w_exp2l.c b/math/w_exp2l.c new file mode 100644 index 0000000000..965e9bf3e4 --- /dev/null +++ b/math/w_exp2l.c @@ -0,0 +1,30 @@ +/* + * wrapper exp2l(x) + */ + +#include <float.h> +#include "math.h" +#include "math_private.h" + +static const long double o_threshold = (long double) LDBL_MAX_EXP; +static const long double u_threshold = (long double) LDBL_MIN_EXP; + +long double +__exp2l (long double x) /* wrapper exp2l */ +{ +#ifdef _IEEE_LIBM + return __ieee754_exp2l (x); +#else + long double z; + z = __ieee754_exp2l (x); + if (_LIB_VERSION != _IEEE_ && __finitel (x)) + { + if (x > o_threshold) + return __kernel_standard (x, x, 244); /* exp2l overflow */ + else if (x < u_threshold) + return __kernel_standard (x, x, 245); /* exp2l underflow */ + } + return z; +#endif +} +weak_alias (__exp2l, exp2l) diff --git a/math/w_fmod.c b/math/w_fmod.c new file mode 100644 index 0000000000..0ceeb98c55 --- /dev/null +++ b/math/w_fmod.c @@ -0,0 +1,48 @@ +/* @(#)w_fmod.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $"; +#endif + +/* + * wrapper fmod(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __fmod(double x, double y) /* wrapper fmod */ +#else + double __fmod(x,y) /* wrapper fmod */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_fmod(x,y); +#else + double z; + z = __ieee754_fmod(x,y); + if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z; + if(y==0.0) { + return __kernel_standard(x,y,27); /* fmod(x,0) */ + } else + return z; +#endif +} +weak_alias (__fmod, fmod) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmod, __fmodl) +weak_alias (__fmod, fmodl) +#endif diff --git a/math/w_fmodf.c b/math/w_fmodf.c new file mode 100644 index 0000000000..9afe5ddfdd --- /dev/null +++ b/math/w_fmodf.c @@ -0,0 +1,48 @@ +/* w_fmodf.c -- float version of w_fmod.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $"; +#endif + +/* + * wrapper fmodf(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __fmodf(float x, float y) /* wrapper fmodf */ +#else + float __fmodf(x,y) /* wrapper fmodf */ + float x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_fmodf(x,y); +#else + float z; + z = __ieee754_fmodf(x,y); + if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z; + if(y==(float)0.0) { + /* fmodf(x,0) */ + return (float)__kernel_standard((double)x,(double)y,127); + } else + return z; +#endif +} +weak_alias (__fmodf, fmodf) diff --git a/math/w_fmodl.c b/math/w_fmodl.c new file mode 100644 index 0000000000..71ed4a94a4 --- /dev/null +++ b/math/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/math/w_hypot.c b/math/w_hypot.c new file mode 100644 index 0000000000..e91db17083 --- /dev/null +++ b/math/w_hypot.c @@ -0,0 +1,48 @@ +/* @(#)w_hypot.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $"; +#endif + +/* + * wrapper hypot(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __hypot(double x, double y)/* wrapper hypot */ +#else + double __hypot(x,y) /* wrapper hypot */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_hypot(x,y); +#else + double z; + z = __ieee754_hypot(x,y); + if(_LIB_VERSION == _IEEE_) return z; + if((!__finite(z))&&__finite(x)&&__finite(y)) + return __kernel_standard(x,y,4); /* hypot overflow */ + else + return z; +#endif +} +weak_alias (__hypot, hypot) +#ifdef NO_LONG_DOUBLE +strong_alias (__hypot, __hypotl) +weak_alias (__hypot, hypotl) +#endif diff --git a/math/w_hypotf.c b/math/w_hypotf.c new file mode 100644 index 0000000000..a7e5c1fdb6 --- /dev/null +++ b/math/w_hypotf.c @@ -0,0 +1,48 @@ +/* w_hypotf.c -- float version of w_hypot.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $"; +#endif + +/* + * wrapper hypotf(x,y) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __hypotf(float x, float y) /* wrapper hypotf */ +#else + float __hypotf(x,y) /* wrapper hypotf */ + float x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_hypotf(x,y); +#else + float z; + z = __ieee754_hypotf(x,y); + if(_LIB_VERSION == _IEEE_) return z; + if((!__finitef(z))&&__finitef(x)&&__finitef(y)) + /* hypot overflow */ + return (float)__kernel_standard((double)x,(double)y,104); + else + return z; +#endif +} +weak_alias (__hypotf, hypotf) diff --git a/math/w_hypotl.c b/math/w_hypotl.c new file mode 100644 index 0000000000..2ec215fd13 --- /dev/null +++ b/math/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(long double 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/math/w_j0.c b/math/w_j0.c new file mode 100644 index 0000000000..5a018760bb --- /dev/null +++ b/math/w_j0.c @@ -0,0 +1,76 @@ +/* @(#)w_j0.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $"; +#endif + +/* + * wrapper j0(double x), y0(double x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double j0(double x) /* wrapper j0 */ +#else + double j0(x) /* wrapper j0 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j0(x); +#else + double z = __ieee754_j0(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (j0, j0l) +#endif + + +#ifdef __STDC__ + double y0(double x) /* wrapper y0 */ +#else + double y0(x) /* wrapper y0 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y0(x); +#else + double z; + z = __ieee754_y0(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,8); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,9); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (y0, y0l) +#endif diff --git a/math/w_j0f.c b/math/w_j0f.c new file mode 100644 index 0000000000..32e2eebb56 --- /dev/null +++ b/math/w_j0f.c @@ -0,0 +1,74 @@ +/* w_j0f.c -- float version of w_j0.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $"; +#endif + +/* + * wrapper j0f(float x), y0f(float x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float j0f(float x) /* wrapper j0f */ +#else + float j0f(x) /* wrapper j0f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j0f(x); +#else + float z = __ieee754_j0f(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(fabsf(x)>(float)X_TLOSS) { + /* j0f(|x|>X_TLOSS) */ + return (float)__kernel_standard((double)x,(double)x,134); + } else + return z; +#endif +} + +#ifdef __STDC__ + float y0f(float x) /* wrapper y0f */ +#else + float y0f(x) /* wrapper y0f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y0f(x); +#else + float z; + z = __ieee754_y0f(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z; + if(x <= (float)0.0){ + if(x==(float)0.0) + /* d= -one/(x-x); */ + return (float)__kernel_standard((double)x,(double)x,108); + else + /* d = zero/(x-x); */ + return (float)__kernel_standard((double)x,(double)x,109); + } + if(x>(float)X_TLOSS) { + /* y0(x>X_TLOSS) */ + return (float)__kernel_standard((double)x,(double)x,135); + } else + return z; +#endif +} diff --git a/math/w_j0l.c b/math/w_j0l.c new file mode 100644 index 0000000000..b74d9ddcff --- /dev/null +++ b/math/w_j0l.c @@ -0,0 +1,73 @@ +/* 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 +} + +#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 +} diff --git a/math/w_j1.c b/math/w_j1.c new file mode 100644 index 0000000000..39fe8543b1 --- /dev/null +++ b/math/w_j1.c @@ -0,0 +1,77 @@ +/* @(#)w_j1.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $"; +#endif + +/* + * wrapper of j1,y1 + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double j1(double x) /* wrapper j1 */ +#else + double j1(x) /* wrapper j1 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j1(x); +#else + double z; + z = __ieee754_j1(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (j1, j1l) +#endif + + +#ifdef __STDC__ + double y1(double x) /* wrapper y1 */ +#else + double y1(x) /* wrapper y1 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y1(x); +#else + double z; + z = __ieee754_y1(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard(x,x,10); + else + /* d = zero/(x-x); */ + return __kernel_standard(x,x,11); + } + if(x>X_TLOSS) { + return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (y1, y1l) +#endif diff --git a/math/w_j1f.c b/math/w_j1f.c new file mode 100644 index 0000000000..2a7c8db819 --- /dev/null +++ b/math/w_j1f.c @@ -0,0 +1,75 @@ +/* w_j1f.c -- float version of w_j1.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $"; +#endif + +/* + * wrapper of j1f,y1f + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float j1f(float x) /* wrapper j1f */ +#else + float j1f(x) /* wrapper j1f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_j1f(x); +#else + float z; + z = __ieee754_j1f(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z; + if(fabsf(x)>(float)X_TLOSS) { + /* j1(|x|>X_TLOSS) */ + return (float)__kernel_standard((double)x,(double)x,136); + } else + return z; +#endif +} + +#ifdef __STDC__ + float y1f(float x) /* wrapper y1f */ +#else + float y1f(x) /* wrapper y1f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_y1f(x); +#else + float z; + z = __ieee754_y1f(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z; + if(x <= (float)0.0){ + if(x==(float)0.0) + /* d= -one/(x-x); */ + return (float)__kernel_standard((double)x,(double)x,110); + else + /* d = zero/(x-x); */ + return (float)__kernel_standard((double)x,(double)x,111); + } + if(x>(float)X_TLOSS) { + /* y1(x>X_TLOSS) */ + return (float)__kernel_standard((double)x,(double)x,137); + } else + return z; +#endif +} diff --git a/math/w_j1l.c b/math/w_j1l.c new file mode 100644 index 0000000000..49a486cf8e --- /dev/null +++ b/math/w_j1l.c @@ -0,0 +1,74 @@ +/* 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 +} + +#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 +} diff --git a/math/w_jn.c b/math/w_jn.c new file mode 100644 index 0000000000..85fc383fb7 --- /dev/null +++ b/math/w_jn.c @@ -0,0 +1,99 @@ +/* @(#)w_jn.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $"; +#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__ + double jn(int n, double x) /* wrapper jn */ +#else + double jn(n,x) /* wrapper jn */ + double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_jn(n,x); +#else + double z; + z = __ieee754_jn(n,x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z; + if(fabs(x)>X_TLOSS) { + return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (jn, jnl) +#endif + + +#ifdef __STDC__ + double yn(int n, double x) /* wrapper yn */ +#else + double yn(n,x) /* wrapper yn */ + double x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_yn(n,x); +#else + double z; + z = __ieee754_yn(n,x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z; + if(x <= 0.0){ + if(x==0.0) + /* d= -one/(x-x); */ + return __kernel_standard((double)n,x,12); + else + /* d = zero/(x-x); */ + return __kernel_standard((double)n,x,13); + } + if(x>X_TLOSS) { + return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */ + } else + return z; +#endif +} +#ifdef NO_LONG_DOUBLE +strong_alias (yn, ynl) +#endif diff --git a/math/w_jnf.c b/math/w_jnf.c new file mode 100644 index 0000000000..63ad335573 --- /dev/null +++ b/math/w_jnf.c @@ -0,0 +1,71 @@ +/* w_jnf.c -- float version of w_jn.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float jnf(int n, float x) /* wrapper jnf */ +#else + float jnf(n,x) /* wrapper jnf */ + float x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_jnf(n,x); +#else + float z; + z = __ieee754_jnf(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z; + if(fabsf(x)>(float)X_TLOSS) { + /* jn(|x|>X_TLOSS,n) */ + return (float)__kernel_standard((double)n,(double)x,138); + } else + return z; +#endif +} + +#ifdef __STDC__ + float ynf(int n, float x) /* wrapper ynf */ +#else + float ynf(n,x) /* wrapper ynf */ + float x; int n; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_ynf(n,x); +#else + float z; + z = __ieee754_ynf(n,x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z; + if(x <= (float)0.0){ + if(x==(float)0.0) + /* d= -one/(x-x); */ + return (float)__kernel_standard((double)n,(double)x,112); + else + /* d = zero/(x-x); */ + return (float)__kernel_standard((double)n,(double)x,113); + } + if(x>(float)X_TLOSS) { + /* yn(x>X_TLOSS,n) */ + return (float)__kernel_standard((double)n,(double)x,139); + } else + return z; +#endif +} diff --git a/math/w_jnl.c b/math/w_jnl.c new file mode 100644 index 0000000000..866e3cdb00 --- /dev/null +++ b/math/w_jnl.c @@ -0,0 +1,96 @@ +/* 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 +} + +#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 +} diff --git a/math/w_lgamma.c b/math/w_lgamma.c new file mode 100644 index 0000000000..0cc62a1784 --- /dev/null +++ b/math/w_lgamma.c @@ -0,0 +1,60 @@ +/* @(#)w_lgamma.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $"; +#endif + +/* double lgamma(double x) + * Return the logarithm of the Gamma function of x. + * + * Method: call __ieee754_lgamma_r + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __lgamma(double x) +#else + double __lgamma(x) + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgamma_r(x,&signgam); +#else + double y; + int local_signgam; + y = __ieee754_lgamma_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_signgam; + if(_LIB_VERSION == _IEEE_) return y; + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,15); /* lgamma pole */ + else + return __kernel_standard(x,x,14); /* lgamma overflow */ + } else + return y; +#endif +} +weak_alias (__lgamma, lgamma) +strong_alias (__lgamma, __gamma) +weak_alias (__gamma, gamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma, __lgammal) +weak_alias (__lgamma, lgammal) +strong_alias (__gamma, __gammal) +weak_alias (__gamma, gammal) +#endif diff --git a/math/w_lgamma_r.c b/math/w_lgamma_r.c new file mode 100644 index 0000000000..f3e7d821e2 --- /dev/null +++ b/math/w_lgamma_r.c @@ -0,0 +1,51 @@ +/* @(#)wr_lgamma.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $"; +#endif + +/* + * wrapper double lgamma_r(double x, int *signgamp) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */ +#else + double __lgamma_r(x,signgamp) /* wrapper lgamma_r */ + double x; int *signgamp; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgamma_r(x,signgamp); +#else + double y; + y = __ieee754_lgamma_r(x,signgamp); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,15); /* lgamma pole */ + else + return __kernel_standard(x,x,14); /* lgamma overflow */ + } else + return y; +#endif +} +weak_alias (__lgamma_r, lgamma_r) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma_r, __lgammal_r) +weak_alias (__lgamma_r, lgammal_r) +#endif diff --git a/math/w_lgammaf.c b/math/w_lgammaf.c new file mode 100644 index 0000000000..4c64aa4130 --- /dev/null +++ b/math/w_lgammaf.c @@ -0,0 +1,53 @@ +/* w_lgammaf.c -- float version of w_lgamma.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __lgammaf(float x) +#else + float __lgammaf(x) + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammaf_r(x,&signgam); +#else + float y; + int local_signgam; + y = __ieee754_lgammaf_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_signgam; + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* lgamma pole */ + return (float)__kernel_standard((double)x,(double)x,115); + else + /* lgamma overflow */ + return (float)__kernel_standard((double)x,(double)x,114); + } else + return y; +#endif +} +weak_alias (__lgammaf, lgammaf) +strong_alias (__lgammaf, __gammaf) +weak_alias (__gammaf, gammaf) diff --git a/math/w_lgammaf_r.c b/math/w_lgammaf_r.c new file mode 100644 index 0000000000..66962acc7e --- /dev/null +++ b/math/w_lgammaf_r.c @@ -0,0 +1,52 @@ +/* w_lgammaf_r.c -- float version of w_lgamma_r.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp $"; +#endif + +/* + * wrapper float lgammaf_r(float x, int *signgamp) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */ +#else + float __lgammaf_r(x,signgamp) /* wrapper lgammaf_r */ + float x; int *signgamp; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_lgammaf_r(x,signgamp); +#else + float y; + y = __ieee754_lgammaf_r(x,signgamp); + if(_LIB_VERSION == _IEEE_) return y; + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* lgamma pole */ + return (float)__kernel_standard((double)x,(double)x,115); + else + /* lgamma overflow */ + return (float)__kernel_standard((double)x,(double)x,114); + } else + return y; +#endif +} +weak_alias (__lgammaf_r, lgammaf_r) diff --git a/math/w_lgammal.c b/math/w_lgammal.c new file mode 100644 index 0000000000..41104e47e4 --- /dev/null +++ b/math/w_lgammal.c @@ -0,0 +1,58 @@ +/* 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" + +#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; + int local_signgam; + y = __ieee754_lgammal_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_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) +strong_alias (__lgammal, __gammal) +weak_alias (__gammal, gammal) diff --git a/math/w_lgammal_r.c b/math/w_lgammal_r.c new file mode 100644 index 0000000000..71f5c005d0 --- /dev/null +++ b/math/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/math/w_log.c b/math/w_log.c new file mode 100644 index 0000000000..5f0af79731 --- /dev/null +++ b/math/w_log.c @@ -0,0 +1,48 @@ +/* @(#)w_log.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $"; +#endif + +/* + * wrapper log(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __log(double x) /* wrapper log */ +#else + double __log(x) /* wrapper log */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_log(x); +#else + double z; + z = __ieee754_log(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x) || x > 0.0) return z; + if(x==0.0) + return __kernel_standard(x,x,16); /* log(0) */ + else + return __kernel_standard(x,x,17); /* log(x<0) */ +#endif +} +weak_alias (__log, log) +#ifdef NO_LONG_DOUBLE +strong_alias (__log, __logl) +weak_alias (__log, logl) +#endif diff --git a/math/w_log10.c b/math/w_log10.c new file mode 100644 index 0000000000..8a0a70bdf7 --- /dev/null +++ b/math/w_log10.c @@ -0,0 +1,51 @@ +/* @(#)w_log10.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $"; +#endif + +/* + * wrapper log10(X) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __log10(double x) /* wrapper log10 */ +#else + double __log10(x) /* wrapper log10 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_log10(x); +#else + double z; + z = __ieee754_log10(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(x<=0.0) { + if(x==0.0) + return __kernel_standard(x,x,18); /* log10(0) */ + else + return __kernel_standard(x,x,19); /* log10(x<0) */ + } else + return z; +#endif +} +weak_alias (__log10, log10) +#ifdef NO_LONG_DOUBLE +strong_alias (__log10, __log10l) +weak_alias (__log10, log10l) +#endif diff --git a/math/w_log10f.c b/math/w_log10f.c new file mode 100644 index 0000000000..f90cb0cabc --- /dev/null +++ b/math/w_log10f.c @@ -0,0 +1,52 @@ +/* w_log10f.c -- float version of w_log10.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_log10f.c,v 1.3 1995/05/10 20:49:37 jtc Exp $"; +#endif + +/* + * wrapper log10f(X) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __log10f(float x) /* wrapper log10f */ +#else + float __log10f(x) /* wrapper log10f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_log10f(x); +#else + float z; + z = __ieee754_log10f(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(x<=(float)0.0) { + if(x==(float)0.0) + /* log10(0) */ + return (float)__kernel_standard((double)x,(double)x,118); + else + /* log10(x<0) */ + return (float)__kernel_standard((double)x,(double)x,119); + } else + return z; +#endif +} +weak_alias (__log10f, log10f) diff --git a/math/w_log10l.c b/math/w_log10l.c new file mode 100644 index 0000000000..0d0861689d --- /dev/null +++ b/math/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/math/w_logf.c b/math/w_logf.c new file mode 100644 index 0000000000..9eabe4b34c --- /dev/null +++ b/math/w_logf.c @@ -0,0 +1,49 @@ +/* w_logf.c -- float version of w_log.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_logf.c,v 1.3 1995/05/10 20:49:40 jtc Exp $"; +#endif + +/* + * wrapper logf(x) + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __logf(float x) /* wrapper logf */ +#else + float __logf(x) /* wrapper logf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_logf(x); +#else + float z; + z = __ieee754_logf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x) || x > (float)0.0) return z; + if(x==(float)0.0) + /* logf(0) */ + return (float)__kernel_standard((double)x,(double)x,116); + else + /* logf(x<0) */ + return (float)__kernel_standard((double)x,(double)x,117); +#endif +} +weak_alias (__logf, logf) diff --git a/math/w_logl.c b/math/w_logl.c new file mode 100644 index 0000000000..bb979c26c3 --- /dev/null +++ b/math/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/math/w_pow.c b/math/w_pow.c new file mode 100644 index 0000000000..5850651a1a --- /dev/null +++ b/math/w_pow.c @@ -0,0 +1,70 @@ + + +/* @(#)w_pow.c 5.2 93/10/01 */ +/* + * ==================================================== + * 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 pow(x,y) return x**y + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + double __pow(double x, double y) /* wrapper pow */ +#else + double __pow(x,y) /* wrapper pow */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_pow(x,y); +#else + double z; + z=__ieee754_pow(x,y); + if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z; + if(__isnan(x)) { + if(y==0.0) + return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ + else + return z; + } + if(x==0.0) { + if(y==0.0) + return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ + if(__finite(y)&&y<0.0) { + if (signbit (x) && signbit (z)) + return __kernel_standard(x,y,23); /* pow(-0.0,negative) */ + else + return __kernel_standard(x,y,43); /* pow(+0.0,negative) */ + } + return z; + } + if(!__finite(z)) { + if(__finite(x)&&__finite(y)) { + if(__isnan(z)) + return __kernel_standard(x,y,24); /* pow neg**non-int */ + else + return __kernel_standard(x,y,21); /* pow overflow */ + } + } + if(z==0.0&&__finite(x)&&__finite(y)) + return __kernel_standard(x,y,22); /* pow underflow */ + return z; +#endif +} +weak_alias (__pow, pow) +#ifdef NO_LONG_DOUBLE +strong_alias (__pow, __powl) +weak_alias (__pow, powl) +#endif diff --git a/math/w_powf.c b/math/w_powf.c new file mode 100644 index 0000000000..32196fd89f --- /dev/null +++ b/math/w_powf.c @@ -0,0 +1,77 @@ +/* w_powf.c -- float version of w_pow.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $"; +#endif + +/* + * wrapper powf(x,y) return x**y + */ + +#include "math.h" +#include "math_private.h" + + +#ifdef __STDC__ + float __powf(float x, float y) /* wrapper powf */ +#else + float __powf(x,y) /* wrapper powf */ + float x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_powf(x,y); +#else + float z; + z=__ieee754_powf(x,y); + if(_LIB_VERSION == _IEEE_|| __isnanf(y)) return z; + if(__isnanf(x)) { + if(y==(float)0.0) + /* powf(NaN,0.0) */ + return (float)__kernel_standard((double)x,(double)y,142); + else + return z; + } + if(x==(float)0.0) { + if(y==(float)0.0) + /* powf(0.0,0.0) */ + return (float)__kernel_standard((double)x,(double)y,120); + if(__finitef(y)&&y<(float)0.0) { + if (signbit (x) && signbit (z)) + /* powf(0.0,negative) */ + return (float)__kernel_standard((double)x,(double)y,123); + else + return (float)__kernel_standard((double)x,(double)y,143); + } + return z; + } + if(!__finitef(z)) { + if(__finitef(x)&&__finitef(y)) { + if(__isnanf(z)) + /* powf neg**non-int */ + return (float)__kernel_standard((double)x,(double)y,124); + else + /* powf overflow */ + return (float)__kernel_standard((double)x,(double)y,121); + } + } + if(z==(float)0.0&&__finitef(x)&&__finitef(y)) + /* powf underflow */ + return (float)__kernel_standard((double)x,(double)y,122); + return z; +#endif +} +weak_alias (__powf, powf) diff --git a/math/w_powl.c b/math/w_powl.c new file mode 100644 index 0000000000..17feb9fc61 --- /dev/null +++ b/math/w_powl.c @@ -0,0 +1,68 @@ +/* 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(__finitel(y)&&y<0.0) { + if (signbit (x) && signbit (z)) + return __kernel_standard(x,y,223); /* pow(-0.0,negative) */ + else + return __kernel_standard(x,y,243); /* 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/math/w_remainder.c b/math/w_remainder.c new file mode 100644 index 0000000000..d85a3febce --- /dev/null +++ b/math/w_remainder.c @@ -0,0 +1,47 @@ +/* @(#)w_remainder.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $"; +#endif + +/* + * wrapper remainder(x,p) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __remainder(double x, double y) /* wrapper remainder */ +#else + double __remainder(x,y) /* wrapper remainder */ + double x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_remainder(x,y); +#else + double z; + z = __ieee754_remainder(x,y); + if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z; + if(y==0.0) + return __kernel_standard(x,y,28); /* remainder(x,0) */ + else + return z; +#endif +} +weak_alias (__remainder, remainder) +#ifdef NO_LONG_DOUBLE +strong_alias (__remainder, __remainderl) +weak_alias (__remainder, remainderl) +#endif diff --git a/math/w_remainderf.c b/math/w_remainderf.c new file mode 100644 index 0000000000..58255f5be5 --- /dev/null +++ b/math/w_remainderf.c @@ -0,0 +1,47 @@ +/* w_remainderf.c -- float version of w_remainder.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $"; +#endif + +/* + * wrapper remainderf(x,p) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __remainderf(float x, float y) /* wrapper remainder */ +#else + float __remainderf(x,y) /* wrapper remainder */ + float x,y; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_remainderf(x,y); +#else + float z; + z = __ieee754_remainderf(x,y); + if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z; + if(y==(float)0.0) + /* remainder(x,0) */ + return (float)__kernel_standard((double)x,(double)y,128); + else + return z; +#endif +} +weak_alias (__remainderf, remainderf) diff --git a/math/w_remainderl.c b/math/w_remainderl.c new file mode 100644 index 0000000000..284140174d --- /dev/null +++ b/math/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/math/w_scalb.c b/math/w_scalb.c new file mode 100644 index 0000000000..e5c407a435 --- /dev/null +++ b/math/w_scalb.c @@ -0,0 +1,65 @@ +/* @(#)w_scalb.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $"; +#endif + +/* + * wrapper scalb(double x, double fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include <errno.h> + +#ifdef __STDC__ +#ifdef _SCALB_INT + double __scalb(double x, int fn) /* wrapper scalb */ +#else + double __scalb(double x, double fn) /* wrapper scalb */ +#endif +#else + double __scalb(x,fn) /* wrapper scalb */ +#ifdef _SCALB_INT + double x; int fn; +#else + double x,fn; +#endif +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_scalb(x,fn); +#else + double z; + z = __ieee754_scalb(x,fn); + if(_LIB_VERSION == _IEEE_) return z; + if(!(__finite(z)||__isnan(z))&&__finite(x)) { + return __kernel_standard(x,(double)fn,32); /* scalb overflow */ + } + if(z==0.0&&z!=x) { + return __kernel_standard(x,(double)fn,33); /* scalb underflow */ + } +#ifndef _SCALB_INT + if(!__finite(fn)) __set_errno (ERANGE); +#endif + return z; +#endif +} +weak_alias (__scalb, scalb) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalb, __scalbl) +weak_alias (__scalb, scalbl) +#endif diff --git a/math/w_scalbf.c b/math/w_scalbf.c new file mode 100644 index 0000000000..488a717503 --- /dev/null +++ b/math/w_scalbf.c @@ -0,0 +1,66 @@ +/* w_scalbf.c -- float version of w_scalb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $"; +#endif + +/* + * wrapper scalbf(float x, float fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#include "math.h" +#include "math_private.h" + +#include <errno.h> + +#ifdef __STDC__ +#ifdef _SCALB_INT + float __scalbf(float x, int fn) /* wrapper scalbf */ +#else + float __scalbf(float x, float fn) /* wrapper scalbf */ +#endif +#else + float __scalbf(x,fn) /* wrapper scalbf */ +#ifdef _SCALB_INT + float x; int fn; +#else + float x,fn; +#endif +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_scalbf(x,fn); +#else + float z; + z = __ieee754_scalbf(x,fn); + if(_LIB_VERSION == _IEEE_) return z; + if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) { + /* scalbf overflow */ + return (float)__kernel_standard((double)x,(double)fn,132); + } + if(z==(float)0.0&&z!=x) { + /* scalbf underflow */ + return (float)__kernel_standard((double)x,(double)fn,133); + } +#ifndef _SCALB_INT + if(!__finitef(fn)) __set_errno (ERANGE); +#endif + return z; +#endif +} +weak_alias (__scalbf, scalbf) diff --git a/math/w_scalbl.c b/math/w_scalbl.c new file mode 100644 index 0000000000..3ca8d9601d --- /dev/null +++ b/math/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)) __set_errno (ERANGE); +#endif + return z; +#endif +} +weak_alias (__scalbl, scalbl) diff --git a/math/w_sinh.c b/math/w_sinh.c new file mode 100644 index 0000000000..9b34cd1873 --- /dev/null +++ b/math/w_sinh.c @@ -0,0 +1,47 @@ +/* @(#)w_sinh.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $"; +#endif + +/* + * wrapper sinh(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __sinh(double x) /* wrapper sinh */ +#else + double __sinh(x) /* wrapper sinh */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sinh(x); +#else + double z; + z = __ieee754_sinh(x); + if(_LIB_VERSION == _IEEE_) return z; + if(!__finite(z)&&__finite(x)) { + return __kernel_standard(x,x,25); /* sinh overflow */ + } else + return z; +#endif +} +weak_alias (__sinh, sinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__sinh, __sinhl) +weak_alias (__sinh, sinhl) +#endif diff --git a/math/w_sinhf.c b/math/w_sinhf.c new file mode 100644 index 0000000000..a69cf3072d --- /dev/null +++ b/math/w_sinhf.c @@ -0,0 +1,47 @@ +/* w_sinhf.c -- float version of w_sinh.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_sinhf.c,v 1.3 1995/05/10 20:49:54 jtc Exp $"; +#endif + +/* + * wrapper sinhf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __sinhf(float x) /* wrapper sinhf */ +#else + float __sinhf(x) /* wrapper sinhf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sinhf(x); +#else + float z; + z = __ieee754_sinhf(x); + if(_LIB_VERSION == _IEEE_) return z; + if(!__finitef(z)&&__finitef(x)) { + /* sinhf overflow */ + return (float)__kernel_standard((double)x,(double)x,125); + } else + return z; +#endif +} +weak_alias (__sinhf, sinhf) diff --git a/math/w_sinhl.c b/math/w_sinhl.c new file mode 100644 index 0000000000..3e93cc598d --- /dev/null +++ b/math/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/math/w_sqrt.c b/math/w_sqrt.c new file mode 100644 index 0000000000..be15d959ea --- /dev/null +++ b/math/w_sqrt.c @@ -0,0 +1,47 @@ +/* @(#)w_sqrt.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $"; +#endif + +/* + * wrapper sqrt(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __sqrt(double x) /* wrapper sqrt */ +#else + double __sqrt(x) /* wrapper sqrt */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sqrt(x); +#else + double z; + z = __ieee754_sqrt(x); + if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; + if(x<0.0) { + return __kernel_standard(x,x,26); /* sqrt(negative) */ + } else + return z; +#endif +} +weak_alias (__sqrt, sqrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__sqrt, __sqrtl) +weak_alias (__sqrt, sqrtl) +#endif diff --git a/math/w_sqrtf.c b/math/w_sqrtf.c new file mode 100644 index 0000000000..f5ccc73868 --- /dev/null +++ b/math/w_sqrtf.c @@ -0,0 +1,47 @@ +/* w_sqrtf.c -- float version of w_sqrt.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $"; +#endif + +/* + * wrapper sqrtf(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __sqrtf(float x) /* wrapper sqrtf */ +#else + float sqrt(x) /* wrapper sqrtf */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_sqrtf(x); +#else + float z; + z = __ieee754_sqrtf(x); + if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z; + if(x<(float)0.0) { + /* sqrtf(negative) */ + return (float)__kernel_standard((double)x,(double)x,126); + } else + return z; +#endif +} +weak_alias (__sqrtf, sqrtf) diff --git a/math/w_sqrtl.c b/math/w_sqrtl.c new file mode 100644 index 0000000000..5873ce93ab --- /dev/null +++ b/math/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) diff --git a/math/w_tgamma.c b/math/w_tgamma.c new file mode 100644 index 0000000000..2adbc2e14d --- /dev/null +++ b/math/w_tgamma.c @@ -0,0 +1,54 @@ +/* @(#)w_gamma.c 5.1 93/09/24 */ +/* + * ==================================================== + * 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: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $"; +#endif + +/* double gamma(double x) + * Return the logarithm of the Gamma function of x or the Gamma function of x, + * depending on the library mode. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + double __tgamma(double x) +#else + double __tgamma(x) + double x; +#endif +{ + double y; + int local_signgam; + y = __ieee754_gamma_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!__finite(y)&&__finite(x)) { + if(__floor(x)==x&&x<=0.0) + return __kernel_standard(x,x,41); /* tgamma pole */ + else + return __kernel_standard(x,x,40); /* tgamma overflow */ + } + return y; +#endif +} +weak_alias (__tgamma, tgamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__tgamma, __tgammal) +weak_alias (__tgamma, tgammal) +#endif diff --git a/math/w_tgammaf.c b/math/w_tgammaf.c new file mode 100644 index 0000000000..152f4be156 --- /dev/null +++ b/math/w_tgammaf.c @@ -0,0 +1,50 @@ +/* w_gammaf.c -- float version of w_gamma.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@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: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $"; +#endif + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + float __tgammaf(float x) +#else + float __tgammaf(x) + float x; +#endif +{ + float y; + int local_signgam; + y = __ieee754_gammaf_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!__finitef(y)&&__finitef(x)) { + if(__floorf(x)==x&&x<=(float)0.0) + /* tgammaf pole */ + return (float)__kernel_standard((double)x,(double)x,141); + else + /* tgammaf overflow */ + return (float)__kernel_standard((double)x,(double)x,140); + } + return y; +#endif +} +weak_alias (__tgammaf, tgammaf) diff --git a/math/w_tgammal.c b/math/w_tgammal.c new file mode 100644 index 0000000000..9efce2bb95 --- /dev/null +++ b/math/w_tgammal.c @@ -0,0 +1,53 @@ +/* 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 Gamma function of x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ + long double __tgammal(long double x) +#else + long double __tgammal(x) + long double x; +#endif +{ + long double y; + int local_signgam; + y = __ieee754_gammal_r(x,&local_signgam); + if (local_signgam < 0) y = -y; +#ifdef _IEEE_LIBM + return y; +#else + if(_LIB_VERSION == _IEEE_) return y; + + if(!__finitel(y)&&__finitel(x)) { + if(__floorl(x)==x&&x<=0.0) + return __kernel_standard(x,x,241); /* tgamma pole */ + else + return __kernel_standard(x,x,240); /* tgamma overflow */ + } + return y; +#endif +} +weak_alias (__tgammal, tgammal) |