Path: blob/master/src/java.base/share/native/libfdlibm/fdlibm.h
41149 views
/*1* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifdef _ALLBSD_SOURCE26#include <machine/endian.h>27#elif defined(__linux__)28#define __USE_BSD 129#include <endian.h>30#endif31#include "jfdlibm.h"3233#ifdef __NEWVALID /* special setup for Sun test regime */34#if defined(i386) || defined(i486) || \35defined(intel) || defined(x86) || defined(arm) || \36defined(i86pc) || defined(ia64)37#define _LITTLE_ENDIAN38#endif39#endif4041#ifdef _LITTLE_ENDIAN42#define __HI(x) *(1+(int*)&x)43#define __LO(x) *(int*)&x44#define __HIp(x) *(1+(int*)x)45#define __LOp(x) *(int*)x46#else47#define __HI(x) *(int*)&x48#define __LO(x) *(1+(int*)&x)49#define __HIp(x) *(int*)x50#define __LOp(x) *(1+(int*)x)51#endif5253#ifndef __P54#ifdef __STDC__55#define __P(p) p56#else57#define __P(p) ()58#endif59#endif6061/*62* ANSI/POSIX63*/6465extern int signgam;6667#define MAXFLOAT ((float)3.40282346638528860e+38)6869enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};7071#define _LIB_VERSION_TYPE enum fdversion72#define _LIB_VERSION _fdlib_version7374/* if global variable _LIB_VERSION is not desirable, one may75* change the following to be a constant by:76* #define _LIB_VERSION_TYPE const enum version77* In that case, after one initializes the value _LIB_VERSION (see78* s_lib_version.c) during compile time, it cannot be modified79* in the middle of a program80*/81extern _LIB_VERSION_TYPE _LIB_VERSION;8283#define _IEEE_ fdlibm_ieee84#define _SVID_ fdlibm_svid85#define _XOPEN_ fdlibm_xopen86#define _POSIX_ fdlibm_posix8788struct exception {89int type;90char *name;91double arg1;92double arg2;93double retval;94};9596#define HUGE MAXFLOAT9798/*99* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>100* (one may replace the following line by "#include <values.h>")101*/102103#define X_TLOSS 1.41484755040568800000e+16104105#define DOMAIN 1106#define SING 2107#define OVERFLOW 3108#define UNDERFLOW 4109#define TLOSS 5110#define PLOSS 6111112/*113* ANSI/POSIX114*/115extern double acos __P((double));116extern double asin __P((double));117extern double atan __P((double));118extern double atan2 __P((double, double));119extern double cos __P((double));120extern double sin __P((double));121extern double tan __P((double));122123extern double cosh __P((double));124extern double sinh __P((double));125extern double tanh __P((double));126127extern double exp __P((double));128extern double frexp __P((double, int *));129extern double ldexp __P((double, int));130extern double log __P((double));131extern double log10 __P((double));132extern double modf __P((double, double *));133134extern double sqrt __P((double));135136extern double ceil __P((double));137extern double fabs __P((double));138extern double floor __P((double));139extern double fmod __P((double, double));140141extern double hypot __P((double, double));142extern int isnan __P((double));143extern int finite __P((double));144145extern double atanh __P((double));146extern double cbrt __P((double));147extern double logb __P((double));148extern double nextafter __P((double, double));149extern double remainder __P((double, double));150#ifdef _SCALB_INT151extern double scalb __P((double, int));152#else153extern double scalb __P((double, double));154#endif155156extern int matherr __P((struct exception *));157158/*159* IEEE Test Vector160*/161extern double significand __P((double));162163/*164* Functions callable from C, intended to support IEEE arithmetic.165*/166extern double copysign __P((double, double));167extern int ilogb __P((double));168extern double rint __P((double));169extern double scalbn __P((double, int));170171/*172* BSD math library entry points173*/174extern double expm1 __P((double));175extern double log1p __P((double));176177/* ieee style elementary functions */178extern double __ieee754_sqrt __P((double));179extern double __ieee754_acos __P((double));180extern double __ieee754_log __P((double));181extern double __ieee754_atanh __P((double));182extern double __ieee754_asin __P((double));183extern double __ieee754_atan2 __P((double,double));184extern double __ieee754_exp __P((double));185extern double __ieee754_cosh __P((double));186extern double __ieee754_fmod __P((double,double));187extern double __ieee754_log10 __P((double));188extern double __ieee754_sinh __P((double));189extern double __ieee754_hypot __P((double,double));190extern double __ieee754_remainder __P((double,double));191extern int __ieee754_rem_pio2 __P((double,double*));192#ifdef _SCALB_INT193extern double __ieee754_scalb __P((double,int));194#else195extern double __ieee754_scalb __P((double,double));196#endif197198/* fdlibm kernel function */199extern double __kernel_standard __P((double,double,int));200extern double __kernel_sin __P((double,double,int));201extern double __kernel_cos __P((double,double));202extern double __kernel_tan __P((double,double,int));203extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));204205206