Remove wrappers and other cruft intended to support SVID, mistakes in
C90, and other arcana. Most of these features were never fully supported or enabled by default. Ok: bde, stefanf
This commit is contained in:
parent
76628ce773
commit
e1b61b5b93
@ -12,35 +12,6 @@
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# There are two options in making libm at fdlibm compile time:
|
||||
# _IEEE_LIBM --- IEEE libm; smaller, and somewhat faster
|
||||
# _MULTI_LIBM --- Support multi-standard at runtime by
|
||||
# imposing wrapper functions defined in
|
||||
# math.h:
|
||||
# _IEEE_MODE -- IEEE
|
||||
# _XOPEN_MODE -- X/OPEN
|
||||
# _POSIX_MODE -- POSIX/ANSI
|
||||
# _SVID3_MODE -- SVID
|
||||
#
|
||||
# Here is how to set up CFLAGS to create the desired libm at
|
||||
# compile time:
|
||||
#
|
||||
# CFLAGS = -D_IEEE_LIBM ... IEEE libm (recommended)
|
||||
# CFLAGS = -D_SVID3_MODE ... Multi-standard supported
|
||||
# libm with SVID as the
|
||||
# default standard
|
||||
# CFLAGS = -D_XOPEN_MODE ... Multi-standard supported
|
||||
# libm with XOPEN as the
|
||||
# default standard
|
||||
# CFLAGS = -D_POSIX_MODE ... Multi-standard supported
|
||||
# libm with POSIX as the
|
||||
# default standard
|
||||
# CFLAGS = ... Multi-standard supported
|
||||
# libm with IEEE as the
|
||||
# default standard
|
||||
#
|
||||
|
||||
# XXX MD crud should be in separate makefiles
|
||||
.if ${MACHINE_ARCH} == "alpha"
|
||||
ARCH_SRCS = s_copysign.S s_copysignf.S
|
||||
@ -86,7 +57,7 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
|
||||
e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \
|
||||
e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c fenv.c \
|
||||
k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
|
||||
k_standard.c k_tan.c k_tanf.c \
|
||||
k_tan.c k_tanf.c \
|
||||
s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_cbrt.c s_cbrtf.c \
|
||||
s_ceil.c s_ceilf.c s_ceill.c \
|
||||
s_copysign.c s_copysignf.c s_cos.c s_cosf.c s_erf.c s_erff.c \
|
||||
@ -95,23 +66,15 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
|
||||
s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \
|
||||
s_fminf.c s_fminl.c s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \
|
||||
s_ilogbl.c s_isfinite.c s_isnan.c s_isnormal.c s_ldexpf.c \
|
||||
s_lib_version.c s_llrint.c s_llrintf.c s_llround.c s_llroundf.c \
|
||||
s_llrint.c s_llrintf.c s_llround.c s_llroundf.c \
|
||||
s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \
|
||||
s_lround.c s_lroundf.c s_matherr.c s_modff.c \
|
||||
s_lround.c s_lroundf.c s_modff.c \
|
||||
s_nearbyint.c s_nextafter.c s_nextafterf.c \
|
||||
s_rint.c s_rintf.c s_round.c s_roundf.c \
|
||||
s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
|
||||
s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c s_tan.c \
|
||||
s_tanf.c s_tanh.c s_tanhf.c s_trunc.c s_truncf.c \
|
||||
w_acos.c w_acosf.c w_acosh.c w_acoshf.c w_asin.c w_asinf.c w_atan2.c \
|
||||
w_atan2f.c w_atanh.c w_atanhf.c w_cabs.c w_cabsf.c w_cosh.c w_coshf.c \
|
||||
w_drem.c w_dremf.c w_exp.c w_expf.c w_fmod.c w_fmodf.c w_gamma.c \
|
||||
w_gamma_r.c w_gammaf.c w_gammaf_r.c w_hypot.c w_hypotf.c w_j0.c \
|
||||
w_j0f.c w_j1.c w_j1f.c w_jn.c w_jnf.c w_lgamma.c w_lgamma_r.c \
|
||||
w_lgammaf.c w_lgammaf_r.c w_log.c w_log10.c w_log10f.c w_logf.c \
|
||||
w_pow.c w_powf.c w_remainder.c w_remainderf.c w_scalb.c w_scalbf.c \
|
||||
w_sinh.c w_sinhf.c w_sqrt.c w_sqrtf.c \
|
||||
w_y0.c w_y0f.c w_y1.c w_y1f.c w_yn.c w_ynf.c
|
||||
w_cabs.c w_cabsf.c w_drem.c w_dremf.c
|
||||
|
||||
# Location of fpmath.h and _fpmath.h
|
||||
LIBCDIR= ${.CURDIR}/../libc
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_sqrt)
|
||||
ENTRY(sqrt)
|
||||
sqrtsd %xmm0, %xmm0
|
||||
ret
|
||||
|
||||
|
@ -42,7 +42,7 @@ RCSID("$FreeBSD$")
|
||||
* Actually evaluate (1 - x^2) as (1 - x) * (1 + x) to avoid loss of
|
||||
* precision when |x| is nearly 1.
|
||||
*/
|
||||
ENTRY(__ieee754_acos)
|
||||
ENTRY(acos)
|
||||
fldl 4(%esp) /* x */
|
||||
fld1
|
||||
fld %st(0)
|
||||
|
@ -42,7 +42,7 @@ RCSID("$FreeBSD$")
|
||||
* Actually evaluate (1 - x^2) as (1 - x) * (1 + x) to avoid loss of
|
||||
* precision when |x| is nearly 1.
|
||||
*/
|
||||
ENTRY(__ieee754_asin)
|
||||
ENTRY(asin)
|
||||
fldl 4(%esp) /* x */
|
||||
fld1
|
||||
fld %st(0)
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_atan2)
|
||||
ENTRY(atan2)
|
||||
fldl 4(%esp)
|
||||
fldl 12(%esp)
|
||||
fpatan
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_atan2f.S,v 1.1 1995/05/08 23:35:10 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_atan2f)
|
||||
ENTRY(atan2f)
|
||||
flds 4(%esp)
|
||||
flds 8(%esp)
|
||||
fpatan
|
||||
|
@ -38,7 +38,7 @@
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
/* e^x = 2^(x * log2(e)) */
|
||||
ENTRY(__ieee754_exp)
|
||||
ENTRY(exp)
|
||||
/*
|
||||
* If x is +-Inf, then the subtraction would give Inf-Inf = NaN.
|
||||
* Avoid this. Also avoid it if x is NaN for convenience.
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_fmod)
|
||||
ENTRY(fmod)
|
||||
fldl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
1: fprem
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_log)
|
||||
ENTRY(log)
|
||||
fldln2
|
||||
fldl 4(%esp)
|
||||
fyl2x
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_log10)
|
||||
ENTRY(log10)
|
||||
fldlg2
|
||||
fldl 4(%esp)
|
||||
fyl2x
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_log10f.S,v 1.1 1996/07/03 16:50:22 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_log10f)
|
||||
ENTRY(log10f)
|
||||
fldlg2
|
||||
flds 4(%esp)
|
||||
fyl2x
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_logf.S,v 1.2 1996/07/06 00:15:45 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_logf)
|
||||
ENTRY(logf)
|
||||
fldln2
|
||||
flds 4(%esp)
|
||||
fyl2x
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_remainder)
|
||||
ENTRY(remainder)
|
||||
fldl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
1: fprem1
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_remainderf)
|
||||
ENTRY(remainderf)
|
||||
flds 8(%esp)
|
||||
flds 4(%esp)
|
||||
1: fprem1
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_scalb)
|
||||
ENTRY(scalb)
|
||||
fldl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
fscale
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_scalbf.S,v 1.1 1996/07/03 16:50:24 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_scalbf)
|
||||
ENTRY(scalbf)
|
||||
flds 8(%esp)
|
||||
flds 4(%esp)
|
||||
fscale
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
ENTRY(__ieee754_sqrt)
|
||||
ENTRY(sqrt)
|
||||
fldl 4(%esp)
|
||||
fsqrt
|
||||
ret
|
||||
|
@ -8,7 +8,7 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
/* RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $") */
|
||||
|
||||
ENTRY(__ieee754_sqrtf)
|
||||
ENTRY(sqrtf)
|
||||
flds 4(%esp)
|
||||
fsqrt
|
||||
ret
|
||||
|
@ -1,774 +0,0 @@
|
||||
/* @(#)k_standard.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef _USE_WRITE
|
||||
#include <stdio.h> /* fputs(), stderr */
|
||||
#define WRITE2(u,v) fputs(u, stderr)
|
||||
#else /* !defined(_USE_WRITE) */
|
||||
#include <unistd.h> /* write */
|
||||
#define WRITE2(u,v) write(2, u, v)
|
||||
#undef fflush
|
||||
#endif /* !defined(_USE_WRITE) */
|
||||
|
||||
static const double zero = 0.0; /* used as const */
|
||||
|
||||
/*
|
||||
* Standard conformance (non-IEEE) on exception cases.
|
||||
* Mapping:
|
||||
* 1 -- acos(|x|>1)
|
||||
* 2 -- asin(|x|>1)
|
||||
* 3 -- atan2(+-0,+-0)
|
||||
* 4 -- hypot overflow
|
||||
* 5 -- cosh overflow
|
||||
* 6 -- exp overflow
|
||||
* 7 -- exp underflow
|
||||
* 8 -- y0(0)
|
||||
* 9 -- y0(-ve)
|
||||
* 10-- y1(0)
|
||||
* 11-- y1(-ve)
|
||||
* 12-- yn(0)
|
||||
* 13-- yn(-ve)
|
||||
* 14-- lgamma(finite) overflow
|
||||
* 15-- lgamma(-integer)
|
||||
* 16-- log(0)
|
||||
* 17-- log(x<0)
|
||||
* 18-- log10(0)
|
||||
* 19-- log10(x<0)
|
||||
* 20-- pow(0.0,0.0)
|
||||
* 21-- pow(x,y) overflow
|
||||
* 22-- pow(x,y) underflow
|
||||
* 23-- pow(0,negative)
|
||||
* 24-- pow(neg,non-integral)
|
||||
* 25-- sinh(finite) overflow
|
||||
* 26-- sqrt(negative)
|
||||
* 27-- fmod(x,0)
|
||||
* 28-- remainder(x,0)
|
||||
* 29-- acosh(x<1)
|
||||
* 30-- atanh(|x|>1)
|
||||
* 31-- atanh(|x|=1)
|
||||
* 32-- scalb overflow
|
||||
* 33-- scalb underflow
|
||||
* 34-- j0(|x|>X_TLOSS)
|
||||
* 35-- y0(x>X_TLOSS)
|
||||
* 36-- j1(|x|>X_TLOSS)
|
||||
* 37-- y1(x>X_TLOSS)
|
||||
* 38-- jn(|x|>X_TLOSS, n)
|
||||
* 39-- yn(x>X_TLOSS, n)
|
||||
* 40-- gamma(finite) overflow
|
||||
* 41-- gamma(-integer)
|
||||
* 42-- pow(NaN,0.0)
|
||||
*/
|
||||
|
||||
|
||||
double
|
||||
__kernel_standard(double x, double y, int type)
|
||||
{
|
||||
struct exception exc;
|
||||
#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
|
||||
#define HUGE_VAL inf
|
||||
double inf = 0.0;
|
||||
|
||||
SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */
|
||||
#endif
|
||||
|
||||
#ifdef _USE_WRITE
|
||||
(void) fflush(stdout);
|
||||
#endif
|
||||
exc.arg1 = x;
|
||||
exc.arg2 = y;
|
||||
switch(type) {
|
||||
case 1:
|
||||
case 101:
|
||||
/* acos(|x|>1) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "acos" : "acosf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if(_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("acos: DOMAIN error\n", 19);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 102:
|
||||
/* asin(|x|>1) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "asin" : "asinf";
|
||||
exc.retval = zero;
|
||||
if(_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if(_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("asin: DOMAIN error\n", 19);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 103:
|
||||
/* atan2(+-0,+-0) */
|
||||
exc.arg1 = y;
|
||||
exc.arg2 = x;
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "atan2" : "atan2f";
|
||||
exc.retval = zero;
|
||||
if(_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if(_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("atan2: DOMAIN error\n", 20);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 104:
|
||||
/* hypot(finite,finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "hypot" : "hypotf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 105:
|
||||
/* cosh(finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "cosh" : "coshf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
case 106:
|
||||
/* exp(finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "exp" : "expf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 107:
|
||||
/* exp(finite) underflow */
|
||||
exc.type = UNDERFLOW;
|
||||
exc.name = type < 100 ? "exp" : "expf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
case 108:
|
||||
/* y0(0) = -inf */
|
||||
exc.type = DOMAIN; /* should be SING for IEEE */
|
||||
exc.name = type < 100 ? "y0" : "y0f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("y0: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
case 109:
|
||||
/* y0(x<0) = NaN */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "y0" : "y0f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("y0: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
case 110:
|
||||
/* y1(0) = -inf */
|
||||
exc.type = DOMAIN; /* should be SING for IEEE */
|
||||
exc.name = type < 100 ? "y1" : "y1f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("y1: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
case 111:
|
||||
/* y1(x<0) = NaN */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "y1" : "y1f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("y1: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
case 112:
|
||||
/* yn(n,0) = -inf */
|
||||
exc.type = DOMAIN; /* should be SING for IEEE */
|
||||
exc.name = type < 100 ? "yn" : "ynf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("yn: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
case 113:
|
||||
/* yn(x<0) = NaN */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "yn" : "ynf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("yn: DOMAIN error\n", 17);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
case 114:
|
||||
/* lgamma(finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "lgamma" : "lgammaf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
case 115:
|
||||
/* lgamma(-integer) or lgamma(0) */
|
||||
exc.type = SING;
|
||||
exc.name = type < 100 ? "lgamma" : "lgammaf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("lgamma: SING error\n", 19);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
case 116:
|
||||
/* log(0) */
|
||||
exc.type = SING;
|
||||
exc.name = type < 100 ? "log" : "logf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("log: SING error\n", 16);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
case 117:
|
||||
/* log(x<0) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "log" : "logf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("log: DOMAIN error\n", 18);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
case 118:
|
||||
/* log10(0) */
|
||||
exc.type = SING;
|
||||
exc.name = type < 100 ? "log10" : "log10f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("log10: SING error\n", 18);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
case 119:
|
||||
/* log10(x<0) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "log10" : "log10f";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = -HUGE;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("log10: DOMAIN error\n", 20);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
case 120:
|
||||
/* pow(0.0,0.0) */
|
||||
/* error only if _LIB_VERSION == _SVID_ */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
|
||||
else if (!matherr(&exc)) {
|
||||
(void) WRITE2("pow(0,0): DOMAIN error\n", 23);
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
case 121:
|
||||
/* pow(x,y) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
exc.retval = HUGE;
|
||||
y *= 0.5;
|
||||
if(x<zero&&rint(y)!=y) exc.retval = -HUGE;
|
||||
} else {
|
||||
exc.retval = HUGE_VAL;
|
||||
y *= 0.5;
|
||||
if(x<zero&&rint(y)!=y) exc.retval = -HUGE_VAL;
|
||||
}
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
case 122:
|
||||
/* pow(x,y) underflow */
|
||||
exc.type = UNDERFLOW;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 23:
|
||||
case 123:
|
||||
/* 0**neg */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = zero;
|
||||
else
|
||||
exc.retval = -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
case 124:
|
||||
/* neg**non-integral */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = zero;
|
||||
else
|
||||
exc.retval = zero/zero; /* X/Open allow NaN */
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
case 125:
|
||||
/* sinh(finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "sinh" : "sinhf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = ( (x>zero) ? HUGE : -HUGE);
|
||||
else
|
||||
exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
case 126:
|
||||
/* sqrt(x<0) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "sqrt" : "sqrtf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = zero;
|
||||
else
|
||||
exc.retval = zero/zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("sqrt: DOMAIN error\n", 19);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
case 127:
|
||||
/* fmod(x,0) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "fmod" : "fmodf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = x;
|
||||
else
|
||||
exc.retval = zero/zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("fmod: DOMAIN error\n", 20);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
case 128:
|
||||
/* remainder(x,0) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "remainder" : "remainderf";
|
||||
exc.retval = zero/zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("remainder: DOMAIN error\n", 24);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
case 129:
|
||||
/* acosh(x<1) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "acosh" : "acoshf";
|
||||
exc.retval = zero/zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("acosh: DOMAIN error\n", 20);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
case 130:
|
||||
/* atanh(|x|>1) */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "atanh" : "atanhf";
|
||||
exc.retval = zero/zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("atanh: DOMAIN error\n", 20);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 31:
|
||||
case 131:
|
||||
/* atanh(|x|=1) */
|
||||
exc.type = SING;
|
||||
exc.name = type < 100 ? "atanh" : "atanhf";
|
||||
exc.retval = x/zero; /* sign(x)*inf */
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("atanh: SING error\n", 18);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
case 132:
|
||||
/* scalb overflow; SVID also returns +-HUGE_VAL */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "scalb" : "scalbf";
|
||||
exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
case 133:
|
||||
/* scalb underflow */
|
||||
exc.type = UNDERFLOW;
|
||||
exc.name = type < 100 ? "scalb" : "scalbf";
|
||||
exc.retval = copysign(zero,x);
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
case 134:
|
||||
/* j0(|x|>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "j0" : "j0f";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
case 135:
|
||||
/* y0(x>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "y0" : "y0f";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 36:
|
||||
case 136:
|
||||
/* j1(|x|>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "j1" : "j1f";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 37:
|
||||
case 137:
|
||||
/* y1(x>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "y1" : "y1f";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 38:
|
||||
case 138:
|
||||
/* jn(|x|>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "jn" : "jnf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 39:
|
||||
case 139:
|
||||
/* yn(x>X_TLOSS) */
|
||||
exc.type = TLOSS;
|
||||
exc.name = type < 100 ? "yn" : "ynf";
|
||||
exc.retval = zero;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2(exc.name, 2);
|
||||
(void) WRITE2(": TLOSS error\n", 14);
|
||||
}
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
case 140:
|
||||
/* gamma(finite) overflow */
|
||||
exc.type = OVERFLOW;
|
||||
exc.name = type < 100 ? "gamma" : "gammaf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
case 141:
|
||||
/* gamma(-integer) or gamma(0) */
|
||||
exc.type = SING;
|
||||
exc.name = type < 100 ? "gamma" : "gammaf";
|
||||
if (_LIB_VERSION == _SVID_)
|
||||
exc.retval = HUGE;
|
||||
else
|
||||
exc.retval = HUGE_VAL;
|
||||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = EDOM;
|
||||
else if (!matherr(&exc)) {
|
||||
if (_LIB_VERSION == _SVID_) {
|
||||
(void) WRITE2("gamma: SING error\n", 18);
|
||||
}
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
case 142:
|
||||
/* pow(NaN,0.0) */
|
||||
/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
|
||||
exc.type = DOMAIN;
|
||||
exc.name = type < 100 ? "pow" : "powf";
|
||||
exc.retval = x;
|
||||
if (_LIB_VERSION == _IEEE_ ||
|
||||
_LIB_VERSION == _POSIX_) exc.retval = 1.0;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = EDOM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return exc.retval;
|
||||
}
|
@ -150,53 +150,12 @@ extern int signgam;
|
||||
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
|
||||
|
||||
#define _LIB_VERSION_TYPE enum fdversion
|
||||
#define _LIB_VERSION _fdlib_version
|
||||
|
||||
/* if global variable _LIB_VERSION is not desirable, one may
|
||||
* change the following to be a constant by:
|
||||
* #define _LIB_VERSION_TYPE const enum version
|
||||
* In that case, after one initializes the value _LIB_VERSION (see
|
||||
* s_lib_version.c) during compile time, it cannot be modified
|
||||
* in the middle of a program
|
||||
*/
|
||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#define _IEEE_ fdlibm_ieee
|
||||
#define _SVID_ fdlibm_svid
|
||||
#define _XOPEN_ fdlibm_xopen
|
||||
#define _POSIX_ fdlibm_posix
|
||||
|
||||
/* We have a problem when using C++ since `exception' is a reserved
|
||||
name in C++. */
|
||||
#ifndef __cplusplus
|
||||
struct exception {
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Old value from 4.4BSD-Lite math.h; this is probably better. */
|
||||
#define HUGE HUGE_VAL
|
||||
#else
|
||||
#define HUGE MAXFLOAT
|
||||
#endif
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16 /* pi*2**52 */
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/*
|
||||
@ -325,10 +284,6 @@ double lgamma_r(double, int *);
|
||||
* IEEE Test Vector
|
||||
*/
|
||||
double significand(double);
|
||||
|
||||
#ifndef __cplusplus
|
||||
int matherr(struct exception *);
|
||||
#endif
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/* float versions of ANSI/POSIX functions */
|
||||
|
@ -154,71 +154,73 @@ do { \
|
||||
(d) = sf_u.value; \
|
||||
} while (0)
|
||||
|
||||
/* ieee style elementary functions */
|
||||
double __ieee754_sqrt(double);
|
||||
double __ieee754_acos(double);
|
||||
double __ieee754_acosh(double);
|
||||
double __ieee754_log(double);
|
||||
double __ieee754_atanh(double);
|
||||
double __ieee754_asin(double);
|
||||
double __ieee754_atan2(double,double);
|
||||
double __ieee754_exp(double);
|
||||
double __ieee754_cosh(double);
|
||||
double __ieee754_fmod(double,double);
|
||||
double __ieee754_pow(double,double);
|
||||
double __ieee754_lgamma_r(double,int *);
|
||||
double __ieee754_gamma_r(double,int *);
|
||||
double __ieee754_lgamma(double);
|
||||
double __ieee754_gamma(double);
|
||||
double __ieee754_log10(double);
|
||||
double __ieee754_sinh(double);
|
||||
double __ieee754_hypot(double,double);
|
||||
double __ieee754_j0(double);
|
||||
double __ieee754_j1(double);
|
||||
double __ieee754_y0(double);
|
||||
double __ieee754_y1(double);
|
||||
double __ieee754_jn(int,double);
|
||||
double __ieee754_yn(int,double);
|
||||
double __ieee754_remainder(double,double);
|
||||
int __ieee754_rem_pio2(double,double*);
|
||||
double __ieee754_scalb(double,double);
|
||||
/*
|
||||
* ieee style elementary functions
|
||||
*
|
||||
* We rename functions here to improve other sources' diffability
|
||||
* against fdlibm.
|
||||
*/
|
||||
#define __ieee754_sqrt sqrt
|
||||
#define __ieee754_acos acos
|
||||
#define __ieee754_acosh acosh
|
||||
#define __ieee754_log log
|
||||
#define __ieee754_atanh atanh
|
||||
#define __ieee754_asin asin
|
||||
#define __ieee754_atan2 atan2
|
||||
#define __ieee754_exp exp
|
||||
#define __ieee754_cosh cosh
|
||||
#define __ieee754_fmod fmod
|
||||
#define __ieee754_pow pow
|
||||
#define __ieee754_lgamma lgamma
|
||||
#define __ieee754_gamma gamma
|
||||
#define __ieee754_lgamma_r lgamma_r
|
||||
#define __ieee754_gamma_r gamma_r
|
||||
#define __ieee754_log10 log10
|
||||
#define __ieee754_sinh sinh
|
||||
#define __ieee754_hypot hypot
|
||||
#define __ieee754_j0 j0
|
||||
#define __ieee754_j1 j1
|
||||
#define __ieee754_y0 y0
|
||||
#define __ieee754_y1 y1
|
||||
#define __ieee754_jn jn
|
||||
#define __ieee754_yn yn
|
||||
#define __ieee754_remainder remainder
|
||||
#define __ieee754_rem rem
|
||||
#define __ieee754_scalb scalb
|
||||
#define __ieee754_sqrtf sqrtf
|
||||
#define __ieee754_acosf acosf
|
||||
#define __ieee754_acoshf acoshf
|
||||
#define __ieee754_logf logf
|
||||
#define __ieee754_atanhf atanhf
|
||||
#define __ieee754_asinf asinf
|
||||
#define __ieee754_atan2f atan2f
|
||||
#define __ieee754_expf expf
|
||||
#define __ieee754_coshf coshf
|
||||
#define __ieee754_fmodf fmodf
|
||||
#define __ieee754_powf powf
|
||||
#define __ieee754_lgammaf lgammaf
|
||||
#define __ieee754_gammaf gammaf
|
||||
#define __ieee754_lgammaf_r lgammaf_r
|
||||
#define __ieee754_gammaf_r gammaf_r
|
||||
#define __ieee754_log10f log10f
|
||||
#define __ieee754_sinhf sinhf
|
||||
#define __ieee754_hypotf hypotf
|
||||
#define __ieee754_j0f j0f
|
||||
#define __ieee754_j1f j1f
|
||||
#define __ieee754_y0f y0f
|
||||
#define __ieee754_y1f y1f
|
||||
#define __ieee754_jnf jnf
|
||||
#define __ieee754_ynf ynf
|
||||
#define __ieee754_remainderf remainderf
|
||||
#define __ieee754_rem rem
|
||||
#define __ieee754_scalbf scalbf
|
||||
|
||||
/* fdlibm kernel function */
|
||||
double __kernel_standard(double,double,int);
|
||||
double __kernel_sin(double,double,int);
|
||||
double __kernel_cos(double,double);
|
||||
double __kernel_tan(double,double,int);
|
||||
int __kernel_rem_pio2(double*,double*,int,int,int,const int*);
|
||||
|
||||
/* ieee style elementary float functions */
|
||||
float __ieee754_sqrtf(float);
|
||||
float __ieee754_acosf(float);
|
||||
float __ieee754_acoshf(float);
|
||||
float __ieee754_logf(float);
|
||||
float __ieee754_atanhf(float);
|
||||
float __ieee754_asinf(float);
|
||||
float __ieee754_atan2f(float,float);
|
||||
float __ieee754_expf(float);
|
||||
float __ieee754_coshf(float);
|
||||
float __ieee754_fmodf(float,float);
|
||||
float __ieee754_powf(float,float);
|
||||
float __ieee754_lgammaf_r(float,int *);
|
||||
float __ieee754_gammaf_r(float,int *);
|
||||
float __ieee754_lgammaf(float);
|
||||
float __ieee754_gammaf(float);
|
||||
float __ieee754_log10f(float);
|
||||
float __ieee754_sinhf(float);
|
||||
float __ieee754_hypotf(float,float);
|
||||
float __ieee754_j0f(float);
|
||||
float __ieee754_j1f(float);
|
||||
float __ieee754_y0f(float);
|
||||
float __ieee754_y1f(float);
|
||||
float __ieee754_jnf(int,float);
|
||||
float __ieee754_ynf(int,float);
|
||||
float __ieee754_remainderf(float,float);
|
||||
int __ieee754_rem_pio2f(float,float*);
|
||||
float __ieee754_scalbf(float,float);
|
||||
|
||||
/* float versions of fdlibm kernel functions */
|
||||
float __kernel_sinf(float,float,int);
|
||||
float __kernel_cosf(float,float);
|
||||
|
@ -1,39 +0,0 @@
|
||||
/* @(#)s_lib_ver.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MACRO for standards
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
/*
|
||||
* define and initialize _LIB_VERSION
|
||||
*/
|
||||
#ifdef _POSIX_MODE
|
||||
_LIB_VERSION_TYPE _LIB_VERSION = _POSIX_;
|
||||
#else
|
||||
#ifdef _XOPEN_MODE
|
||||
_LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_;
|
||||
#else
|
||||
#ifdef _SVID3_MODE
|
||||
_LIB_VERSION_TYPE _LIB_VERSION = _SVID_;
|
||||
#else /* default _IEEE_MODE */
|
||||
_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
/* @(#)s_matherr.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
int matherr(struct exception *x)
|
||||
{
|
||||
int n=0;
|
||||
if(x->arg1!=x->arg1) return 0;
|
||||
return n;
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrap_acos(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
acos(double x) /* wrapper acos */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrap_acosf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
acosf(float x) /* wrapper acosf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper acosh(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
acosh(double x) /* wrapper acosh */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper acoshf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
acoshf(float x) /* wrapper acoshf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper asin(x)
|
||||
*/
|
||||
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
asin(double x) /* wrapper asin */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper asinf(x)
|
||||
*/
|
||||
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
asinf(float x) /* wrapper asinf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atan2(y,x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
atan2(double y, double x) /* wrapper atan2 */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_atan2(y,x);
|
||||
#else
|
||||
double z;
|
||||
z = __ieee754_atan2(y,x);
|
||||
if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z;
|
||||
if(x==0.0&&y==0.0) {
|
||||
return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
|
||||
} else
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atan2f(y,x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
atan2f(float y, float x) /* wrapper atan2f */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_atan2f(y,x);
|
||||
#else
|
||||
float z;
|
||||
z = __ieee754_atan2f(y,x);
|
||||
if(_LIB_VERSION == _IEEE_||isnanf(x)||isnanf(y)) return z;
|
||||
if(x==(float)0.0&&y==(float)0.0) {
|
||||
/* atan2f(+-0,+-0) */
|
||||
return (float)__kernel_standard((double)y,(double)x,103);
|
||||
} else
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atanh(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
atanh(double x) /* wrapper atanh */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper atanhf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
atanhf(float x) /* wrapper atanhf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper cosh(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
cosh(double x) /* wrapper cosh */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper coshf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
coshf(float x) /* wrapper coshf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* @(#)w_exp.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper exp(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const double
|
||||
o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
|
||||
u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
|
||||
|
||||
double
|
||||
exp(double x) /* wrapper exp */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_exp(x);
|
||||
#else
|
||||
double z;
|
||||
z = __ieee754_exp(x);
|
||||
if(_LIB_VERSION == _IEEE_) return z;
|
||||
if(finite(x)) {
|
||||
if(x>o_threshold)
|
||||
return __kernel_standard(x,x,6); /* exp overflow */
|
||||
else if(x<u_threshold)
|
||||
return __kernel_standard(x,x,7); /* exp underflow */
|
||||
}
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* w_expf.c -- float version of w_exp.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper expf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float
|
||||
o_threshold= 8.8721679688e+01, /* 0x42b17180 */
|
||||
u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */
|
||||
|
||||
float
|
||||
expf(float x) /* wrapper expf */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_expf(x);
|
||||
#else
|
||||
float z;
|
||||
z = __ieee754_expf(x);
|
||||
if(_LIB_VERSION == _IEEE_) return z;
|
||||
if(finitef(x)) {
|
||||
if(x>o_threshold)
|
||||
/* exp overflow */
|
||||
return (float)__kernel_standard((double)x,(double)x,106);
|
||||
else if(x<u_threshold)
|
||||
/* exp underflow */
|
||||
return (float)__kernel_standard((double)x,(double)x,107);
|
||||
}
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper fmod(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
fmod(double x, double y) /* wrapper fmod */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper fmodf(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
fmodf(float x, float y) /* wrapper fmodf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* double gamma(double x)
|
||||
* Return the logarithm of the Gamma function of x.
|
||||
*
|
||||
* Method: call gamma_r
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
extern int signgam;
|
||||
|
||||
double
|
||||
gamma(double x)
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_gamma_r(x,&signgam);
|
||||
#else
|
||||
double y;
|
||||
y = __ieee754_gamma_r(x,&signgam);
|
||||
if(_LIB_VERSION == _IEEE_) return y;
|
||||
if(!finite(y)&&finite(x)) {
|
||||
if(floor(x)==x&&x<=0.0)
|
||||
return __kernel_standard(x,x,41); /* gamma pole */
|
||||
else
|
||||
return __kernel_standard(x,x,40); /* gamma overflow */
|
||||
} else
|
||||
return y;
|
||||
#endif
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* @(#)wr_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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper double gamma_r(double x, int *signgamp)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_gamma_r(x,signgamp);
|
||||
#else
|
||||
double y;
|
||||
y = __ieee754_gamma_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,41); /* gamma pole */
|
||||
else
|
||||
return __kernel_standard(x,x,40); /* gamma overflow */
|
||||
} else
|
||||
return y;
|
||||
#endif
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
extern int signgam;
|
||||
|
||||
float
|
||||
gammaf(float x)
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_gammaf_r(x,&signgam);
|
||||
#else
|
||||
float y;
|
||||
y = __ieee754_gammaf_r(x,&signgam);
|
||||
if(_LIB_VERSION == _IEEE_) return y;
|
||||
if(!finitef(y)&&finitef(x)) {
|
||||
if(floorf(x)==x&&x<=(float)0.0)
|
||||
/* gammaf pole */
|
||||
return (float)__kernel_standard((double)x,(double)x,141);
|
||||
else
|
||||
/* gammaf overflow */
|
||||
return (float)__kernel_standard((double)x,(double)x,140);
|
||||
} else
|
||||
return y;
|
||||
#endif
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* w_gammaf_r.c -- float version of w_gamma_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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper float gammaf_r(float x, int *signgamp)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
gammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_gammaf_r(x,signgamp);
|
||||
#else
|
||||
float y;
|
||||
y = __ieee754_gammaf_r(x,signgamp);
|
||||
if(_LIB_VERSION == _IEEE_) return y;
|
||||
if(!finitef(y)&&finitef(x)) {
|
||||
if(floorf(x)==x&&x<=(float)0.0)
|
||||
/* gammaf pole */
|
||||
return (float)__kernel_standard((double)x,(double)x,141);
|
||||
else
|
||||
/* gamma overflow */
|
||||
return (float)__kernel_standard((double)x,(double)x,140);
|
||||
} else
|
||||
return y;
|
||||
#endif
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper hypot(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
hypot(double x, double y)/* wrapper hypot */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper hypotf(x,y)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
hypotf(float x, float y) /* wrapper hypotf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper j0(double x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
j0(double x) /* wrapper j0 */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper j0f(float x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
j0f(float x) /* wrapper j0f */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper of j1
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
j1(double x) /* wrapper j1 */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper of j1f
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
j1f(float x) /* wrapper j1f */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper jn(int n, double x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
jn(int n, double x) /* wrapper jn */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
jnf(int n, float x) /* wrapper jnf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#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"
|
||||
|
||||
extern int signgam;
|
||||
|
||||
double
|
||||
lgamma(double x)
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_lgamma_r(x,&signgam);
|
||||
#else
|
||||
double y;
|
||||
y = __ieee754_lgamma_r(x,&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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper double lgamma_r(double x, int *signgamp)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
extern int signgam;
|
||||
|
||||
float
|
||||
lgammaf(float x)
|
||||
{
|
||||
#ifdef _IEEE_LIBM
|
||||
return __ieee754_lgammaf_r(x,&signgam);
|
||||
#else
|
||||
float y;
|
||||
y = __ieee754_lgammaf_r(x,&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
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper float lgammaf_r(float x, int *signgamp)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper log(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
log(double x) /* wrapper log */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper log10(X)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
double
|
||||
log10(double x) /* wrapper log10 */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper log10f(X)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
log10f(float x) /* wrapper log10f */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper logf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
logf(float x) /* wrapper logf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
|
||||
|
||||
/* @(#)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"
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
double
|
||||
pow(double x, double y) /* wrapper pow */
|
||||
{
|
||||
#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)
|
||||
return __kernel_standard(x,y,23); /* 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
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper powf(x,y) return x**y
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
float
|
||||
powf(float x, float y) /* wrapper powf */
|
||||
{
|
||||
#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)
|
||||
/* powf(0.0,negative) */
|
||||
return (float)__kernel_standard((double)x,(double)y,123);
|
||||
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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper remainder(x,p)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
remainder(double x, double y) /* wrapper remainder */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper remainderf(x,p)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
remainderf(float x, float y) /* wrapper remainder */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#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 _SCALB_INT
|
||||
double
|
||||
scalb(double x, int fn) /* wrapper scalb */
|
||||
#else
|
||||
double
|
||||
scalb(double x, double fn) /* wrapper scalb */
|
||||
#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)) errno = ERANGE;
|
||||
#endif
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#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 _SCALB_INT
|
||||
float
|
||||
scalbf(float x, int fn) /* wrapper scalbf */
|
||||
#else
|
||||
float
|
||||
scalbf(float x, float fn) /* wrapper scalbf */
|
||||
#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)) errno = ERANGE;
|
||||
#endif
|
||||
return z;
|
||||
#endif
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper sinh(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
sinh(double x) /* wrapper sinh */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper sinhf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
sinhf(float x) /* wrapper sinhf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper sqrt(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
sqrt(double x) /* wrapper sqrt */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* 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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper sqrtf(x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
sqrtf(float x) /* wrapper sqrtf */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* from: @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper y0(double x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
y0(double x) /* wrapper y0 */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* w_y0f.c -- float version of w_y0.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper y0f(float x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
y0f(float x) /* wrapper y0f */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* from: @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper of y1
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
y1(double x) /* wrapper y1 */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* w_y1f.c -- float version of w_y1.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper of y1f
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
y1f(float x) /* wrapper y1f */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* from: @(#)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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wrapper yn(int n, double x)
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double
|
||||
yn(int n, double x) /* wrapper yn */
|
||||
{
|
||||
#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
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* w_ynf.c -- float version of w_yn.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.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
float
|
||||
ynf(int n, float x) /* wrapper ynf */
|
||||
{
|
||||
#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
|
||||
}
|
Loading…
Reference in New Issue
Block a user