0N/A
0N/A/*
3767N/A * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
4632N/A#ifdef _ALLBSD_SOURCE
4632N/A#include <machine/endian.h>
4632N/A#elif __linux__
4632N/A#define __USE_BSD 1
4632N/A#include <endian.h>
4632N/A#endif
0N/A#include "jfdlibm.h"
0N/A
0N/A#ifdef __NEWVALID /* special setup for Sun test regime */
0N/A#if defined(i386) || defined(i486) || \
3767N/A defined(intel) || defined(x86) || defined(arm) || \
3767N/A defined(i86pc) || defined(_M_IA64) || defined(ia64)
0N/A#define _LITTLE_ENDIAN
0N/A#endif
0N/A#endif
0N/A
0N/A#ifdef _LITTLE_ENDIAN
0N/A#define __HI(x) *(1+(int*)&x)
0N/A#define __LO(x) *(int*)&x
0N/A#define __HIp(x) *(1+(int*)x)
0N/A#define __LOp(x) *(int*)x
0N/A#else
0N/A#define __HI(x) *(int*)&x
0N/A#define __LO(x) *(1+(int*)&x)
0N/A#define __HIp(x) *(int*)x
0N/A#define __LOp(x) *(1+(int*)x)
0N/A#endif
0N/A
2884N/A#ifndef __P
0N/A#ifdef __STDC__
0N/A#define __P(p) p
0N/A#else
0N/A#define __P(p) ()
0N/A#endif
2884N/A#endif
0N/A
0N/A/*
0N/A * ANSI/POSIX
0N/A */
0N/A
0N/Aextern int signgam;
0N/A
0N/A#define MAXFLOAT ((float)3.40282346638528860e+38)
0N/A
0N/Aenum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
0N/A
0N/A#define _LIB_VERSION_TYPE enum fdversion
0N/A#define _LIB_VERSION _fdlib_version
0N/A
0N/A/* if global variable _LIB_VERSION is not desirable, one may
0N/A * change the following to be a constant by:
0N/A * #define _LIB_VERSION_TYPE const enum version
0N/A * In that case, after one initializes the value _LIB_VERSION (see
0N/A * s_lib_version.c) during compile time, it cannot be modified
0N/A * in the middle of a program
0N/A */
0N/Aextern _LIB_VERSION_TYPE _LIB_VERSION;
0N/A
0N/A#define _IEEE_ fdlibm_ieee
0N/A#define _SVID_ fdlibm_svid
0N/A#define _XOPEN_ fdlibm_xopen
0N/A#define _POSIX_ fdlibm_posix
0N/A
0N/Astruct exception {
0N/A int type;
0N/A char *name;
0N/A double arg1;
0N/A double arg2;
0N/A double retval;
0N/A};
0N/A
0N/A#define HUGE MAXFLOAT
0N/A
0N/A/*
0N/A * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
0N/A * (one may replace the following line by "#include <values.h>")
0N/A */
0N/A
0N/A#define X_TLOSS 1.41484755040568800000e+16
0N/A
0N/A#define DOMAIN 1
0N/A#define SING 2
0N/A#define OVERFLOW 3
0N/A#define UNDERFLOW 4
0N/A#define TLOSS 5
0N/A#define PLOSS 6
0N/A
0N/A/*
0N/A * ANSI/POSIX
0N/A */
0N/Aextern double acos __P((double));
0N/Aextern double asin __P((double));
0N/Aextern double atan __P((double));
0N/Aextern double atan2 __P((double, double));
0N/Aextern double cos __P((double));
0N/Aextern double sin __P((double));
0N/Aextern double tan __P((double));
0N/A
0N/Aextern double cosh __P((double));
0N/Aextern double sinh __P((double));
0N/Aextern double tanh __P((double));
0N/A
0N/Aextern double exp __P((double));
0N/Aextern double frexp __P((double, int *));
0N/Aextern double ldexp __P((double, int));
0N/Aextern double log __P((double));
0N/Aextern double log10 __P((double));
0N/Aextern double modf __P((double, double *));
0N/A
0N/Aextern double pow __P((double, double));
0N/Aextern double sqrt __P((double));
0N/A
0N/Aextern double ceil __P((double));
0N/Aextern double fabs __P((double));
0N/Aextern double floor __P((double));
0N/Aextern double fmod __P((double, double));
0N/A
4632N/Aextern double erf __P((double));
4632N/Aextern double erfc __P((double));
4632N/Aextern double gamma __P((double));
0N/Aextern double hypot __P((double, double));
0N/Aextern int isnan __P((double));
0N/Aextern int finite __P((double));
4632N/Aextern double j0 __P((double));
4632N/Aextern double j1 __P((double));
4632N/Aextern double jn __P((int, double));
4632N/Aextern double lgamma __P((double));
4632N/Aextern double y0 __P((double));
4632N/Aextern double y1 __P((double));
4632N/Aextern double yn __P((int, double));
0N/A
4632N/Aextern double acosh __P((double));
4632N/Aextern double asinh __P((double));
0N/Aextern double atanh __P((double));
0N/Aextern double cbrt __P((double));
0N/Aextern double logb __P((double));
0N/Aextern double nextafter __P((double, double));
0N/Aextern double remainder __P((double, double));
0N/A#ifdef _SCALB_INT
0N/Aextern double scalb __P((double, int));
0N/A#else
0N/Aextern double scalb __P((double, double));
0N/A#endif
0N/A
0N/Aextern int matherr __P((struct exception *));
0N/A
0N/A/*
0N/A * IEEE Test Vector
0N/A */
0N/Aextern double significand __P((double));
0N/A
0N/A/*
0N/A * Functions callable from C, intended to support IEEE arithmetic.
0N/A */
0N/Aextern double copysign __P((double, double));
0N/Aextern int ilogb __P((double));
0N/Aextern double rint __P((double));
0N/Aextern double scalbn __P((double, int));
0N/A
0N/A/*
0N/A * BSD math library entry points
0N/A */
0N/Aextern double expm1 __P((double));
0N/Aextern double log1p __P((double));
0N/A
4632N/A/*
4632N/A * Reentrant version of gamma & lgamma; passes signgam back by reference
4632N/A * as the second argument; user must allocate space for signgam.
4632N/A */
4632N/A#ifdef _REENTRANT
4632N/Aextern double gamma_r __P((double, int *));
4632N/Aextern double lgamma_r __P((double, int *));
4632N/A#endif /* _REENTRANT */
4632N/A
0N/A/* ieee style elementary functions */
0N/Aextern double __ieee754_sqrt __P((double));
0N/Aextern double __ieee754_acos __P((double));
4632N/Aextern double __ieee754_acosh __P((double));
0N/Aextern double __ieee754_log __P((double));
0N/Aextern double __ieee754_atanh __P((double));
0N/Aextern double __ieee754_asin __P((double));
0N/Aextern double __ieee754_atan2 __P((double,double));
0N/Aextern double __ieee754_exp __P((double));
0N/Aextern double __ieee754_cosh __P((double));
0N/Aextern double __ieee754_fmod __P((double,double));
0N/Aextern double __ieee754_pow __P((double,double));
4632N/Aextern double __ieee754_lgamma_r __P((double,int *));
4632N/Aextern double __ieee754_gamma_r __P((double,int *));
4632N/Aextern double __ieee754_lgamma __P((double));
4632N/Aextern double __ieee754_gamma __P((double));
0N/Aextern double __ieee754_log10 __P((double));
0N/Aextern double __ieee754_sinh __P((double));
0N/Aextern double __ieee754_hypot __P((double,double));
4632N/Aextern double __ieee754_j0 __P((double));
4632N/Aextern double __ieee754_j1 __P((double));
4632N/Aextern double __ieee754_y0 __P((double));
4632N/Aextern double __ieee754_y1 __P((double));
4632N/Aextern double __ieee754_jn __P((int,double));
4632N/Aextern double __ieee754_yn __P((int,double));
0N/Aextern double __ieee754_remainder __P((double,double));
0N/Aextern int __ieee754_rem_pio2 __P((double,double*));
0N/A#ifdef _SCALB_INT
0N/Aextern double __ieee754_scalb __P((double,int));
0N/A#else
0N/Aextern double __ieee754_scalb __P((double,double));
0N/A#endif
0N/A
0N/A/* fdlibm kernel function */
0N/Aextern double __kernel_standard __P((double,double,int));
0N/Aextern double __kernel_sin __P((double,double,int));
0N/Aextern double __kernel_cos __P((double,double));
0N/Aextern double __kernel_tan __P((double,double,int));
0N/Aextern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));