Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
38918 views
1/*2* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation. Oracle designates this8* particular file as subject to the "Classpath" exception as provided9* by Oracle in the LICENSE file that accompanied this code.10*11* This code is distributed in the hope that it will be useful, but WITHOUT12* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14* version 2 for more details (a copy is included in the LICENSE file that15* accompanied this code).16*17* You should have received a copy of the GNU General Public License version18* 2 along with this work; if not, write to the Free Software Foundation,19* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.20*21* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA22* or visit www.oracle.com if you need additional information or have any23* questions.24*/2526#ifdef _ALLBSD_SOURCE27#include <machine/endian.h>28#elif __linux__29#define __USE_BSD 130#include <endian.h>31#endif32#include "jfdlibm.h"3334#ifdef __NEWVALID /* special setup for Sun test regime */35#if defined(i386) || defined(i486) || \36defined(intel) || defined(x86) || defined(arm) || \37defined(i86pc) || defined(_M_IA64) || defined(ia64)38#define _LITTLE_ENDIAN39#endif40#endif4142#ifdef _LITTLE_ENDIAN43#define __HI(x) *(1+(int*)&x)44#define __LO(x) *(int*)&x45#define __HIp(x) *(1+(int*)x)46#define __LOp(x) *(int*)x47#else48#define __HI(x) *(int*)&x49#define __LO(x) *(1+(int*)&x)50#define __HIp(x) *(int*)x51#define __LOp(x) *(1+(int*)x)52#endif5354#ifndef __P55#ifdef __STDC__56#define __P(p) p57#else58#define __P(p) ()59#endif60#endif6162/*63* ANSI/POSIX64*/6566extern int signgam;6768#define MAXFLOAT ((float)3.40282346638528860e+38)6970enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};7172#define _LIB_VERSION_TYPE enum fdversion73#define _LIB_VERSION _fdlib_version7475/* if global variable _LIB_VERSION is not desirable, one may76* change the following to be a constant by:77* #define _LIB_VERSION_TYPE const enum version78* In that case, after one initializes the value _LIB_VERSION (see79* s_lib_version.c) during compile time, it cannot be modified80* in the middle of a program81*/82extern _LIB_VERSION_TYPE _LIB_VERSION;8384#define _IEEE_ fdlibm_ieee85#define _SVID_ fdlibm_svid86#define _XOPEN_ fdlibm_xopen87#define _POSIX_ fdlibm_posix8889struct exception {90int type;91char *name;92double arg1;93double arg2;94double retval;95};9697#define HUGE MAXFLOAT9899/*100* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>101* (one may replace the following line by "#include <values.h>")102*/103104#define X_TLOSS 1.41484755040568800000e+16105106#define DOMAIN 1107#define SING 2108#define OVERFLOW 3109#define UNDERFLOW 4110#define TLOSS 5111#define PLOSS 6112113/*114* ANSI/POSIX115*/116extern double acos __P((double));117extern double asin __P((double));118extern double atan __P((double));119extern double atan2 __P((double, double));120extern double cos __P((double));121extern double sin __P((double));122extern double tan __P((double));123124extern double cosh __P((double));125extern double sinh __P((double));126extern double tanh __P((double));127128extern double exp __P((double));129extern double frexp __P((double, int *));130extern double ldexp __P((double, int));131extern double log __P((double));132extern double log10 __P((double));133extern double modf __P((double, double *));134135extern double pow __P((double, double));136extern double sqrt __P((double));137138extern double ceil __P((double));139extern double fabs __P((double));140extern double floor __P((double));141extern double fmod __P((double, double));142143extern double hypot __P((double, double));144extern int isnan __P((double));145extern int finite __P((double));146147extern double atanh __P((double));148extern double cbrt __P((double));149extern double logb __P((double));150extern double nextafter __P((double, double));151extern double remainder __P((double, double));152#ifdef _SCALB_INT153extern double scalb __P((double, int));154#else155extern double scalb __P((double, double));156#endif157158extern int matherr __P((struct exception *));159160/*161* IEEE Test Vector162*/163extern double significand __P((double));164165/*166* Functions callable from C, intended to support IEEE arithmetic.167*/168extern double copysign __P((double, double));169extern int ilogb __P((double));170extern double rint __P((double));171extern double scalbn __P((double, int));172173/*174* BSD math library entry points175*/176extern double expm1 __P((double));177extern double log1p __P((double));178179/* ieee style elementary functions */180extern double __ieee754_sqrt __P((double));181extern double __ieee754_acos __P((double));182extern double __ieee754_log __P((double));183extern double __ieee754_atanh __P((double));184extern double __ieee754_asin __P((double));185extern double __ieee754_atan2 __P((double,double));186extern double __ieee754_exp __P((double));187extern double __ieee754_cosh __P((double));188extern double __ieee754_fmod __P((double,double));189extern double __ieee754_pow __P((double,double));190extern double __ieee754_log10 __P((double));191extern double __ieee754_sinh __P((double));192extern double __ieee754_hypot __P((double,double));193extern double __ieee754_remainder __P((double,double));194extern int __ieee754_rem_pio2 __P((double,double*));195#ifdef _SCALB_INT196extern double __ieee754_scalb __P((double,int));197#else198extern double __ieee754_scalb __P((double,double));199#endif200201/* fdlibm kernel function */202extern double __kernel_standard __P((double,double,int));203extern double __kernel_sin __P((double,double,int));204extern double __kernel_cos __P((double,double));205extern double __kernel_tan __P((double,double,int));206extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));207208209