2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1995 by NeXT Computer, Inc. All rights reserved. */
24 * ====================================================
25 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
27 * Developed at SunPro, a Sun Microsystems, Inc. business.
28 * Permission to use, copy, modify, and distribute this
29 * software is freely granted, provided that this notice
31 * ====================================================
40 #define HUGE_VAL 1e500 /* IEEE: positive infinity */
45 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
46 #define M_E 2.7182818284590452354 /* e */
47 #define M_LOG2E 1.4426950408889634074 /* log 2e */
48 #define M_LOG10E 0.43429448190325182765 /* log 10e */
49 #define M_LN2 0.69314718055994530942 /* log e2 */
50 #define M_LN10 2.30258509299404568402 /* log e10 */
51 #define M_PI 3.14159265358979323846 /* pi */
52 #define M_PI_2 1.57079632679489661923 /* pi/2 */
53 #define M_PI_4 0.78539816339744830962 /* pi/4 */
54 #define M_1_PI 0.31830988618379067154 /* 1/pi */
55 #define M_2_PI 0.63661977236758134308 /* 2/pi */
56 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
57 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
58 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
60 #define MAXFLOAT ((float)3.40282346638528860e+38)
63 #if !defined(_XOPEN_SOURCE)
64 enum fdversion
{fdlibm_ieee
= -1, fdlibm_svid
, fdlibm_xopen
, fdlibm_posix
};
66 #define _LIB_VERSION_TYPE enum fdversion
67 #define _LIB_VERSION _fdlib_version
69 /* if global variable _LIB_VERSION is not desirable, one may
70 * change the following to be a constant by:
71 * #define _LIB_VERSION_TYPE const enum version
72 * In that case, after one initializes the value _LIB_VERSION (see
73 * s_lib_version.c) during compile time, it cannot be modified
74 * in the middle of a program
76 extern _LIB_VERSION_TYPE _LIB_VERSION
;
78 #define _IEEE_ fdlibm_ieee
79 #define _SVID_ fdlibm_svid
80 #define _XOPEN_ fdlibm_xopen
81 #define _POSIX_ fdlibm_posix
83 #if !defined(__cplusplus)
96 * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
97 * (one may replace the following line by "#include <values.h>")
100 #define X_TLOSS 1.41484755040568800000e+16
109 #endif /* !_XOPEN_SOURCE */
110 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
113 #include <sys/cdefs.h>
118 extern __pure
double acos
__P((double));
119 extern __pure
double asin
__P((double));
120 extern __pure
double atan
__P((double));
121 extern __pure
double atan2
__P((double, double));
122 extern __pure
double cos
__P((double));
123 extern __pure
double sin
__P((double));
124 extern __pure
double tan
__P((double));
126 extern __pure
double cosh
__P((double));
127 extern __pure
double sinh
__P((double));
128 extern __pure
double tanh
__P((double));
130 extern __pure
double exp
__P((double));
131 extern double frexp
__P((double, int *));
132 extern __pure
double ldexp
__P((double, int));
133 extern __pure
double log
__P((double));
134 extern __pure
double log10
__P((double));
135 extern double modf
__P((double, double *));
137 extern __pure
double pow
__P((double, double));
138 extern __pure
double sqrt
__P((double));
140 extern __pure
double ceil
__P((double));
141 extern __pure
double fabs
__P((double));
142 extern __pure
double floor
__P((double));
143 extern __pure
double fmod
__P((double, double));
145 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
146 extern __pure
double erf
__P((double));
147 extern __pure
double erfc
__P((double));
148 extern double gamma
__P((double));
149 extern __pure
double hypot
__P((double, double));
150 extern __pure
int isinf
__P((double));
151 extern __pure
int isnan
__P((double));
152 extern __pure
int finite
__P((double));
153 extern __pure
double j0
__P((double));
154 extern __pure
double j1
__P((double));
155 extern __pure
double jn
__P((int, double));
156 extern double lgamma
__P((double));
157 extern __pure
double y0
__P((double));
158 extern __pure
double y1
__P((double));
159 extern __pure
double yn
__P((int, double));
161 #if !defined(_XOPEN_SOURCE)
162 extern __pure
double acosh
__P((double));
163 extern __pure
double asinh
__P((double));
164 extern __pure
double atanh
__P((double));
165 extern __pure
double cbrt
__P((double));
166 extern __pure
double logb
__P((double));
167 extern __pure
double nextafter
__P((double, double));
168 extern __pure
double remainder
__P((double, double));
169 extern __pure
double scalb
__P((double, int));
172 extern int matherr
__P((struct exception
*));
178 extern __pure
double significand
__P((double));
181 * Functions callable from C, intended to support IEEE arithmetic.
183 extern __pure
double copysign
__P((double, double));
184 extern __pure
int ilogb
__P((double));
185 extern __pure
double rint
__P((double));
186 extern __pure
double scalbn
__P((double, int));
189 * BSD math library entry points
191 extern double cabs();
192 extern __pure
double drem
__P((double, double));
193 extern __pure
double expm1
__P((double));
194 extern __pure
double log1p
__P((double));
197 * Reentrant version of gamma & lgamma; passes signgam back by reference
198 * as the second argument; user must allocate space for signgam.
201 extern double gamma_r
__P((double, int *));
202 extern double lgamma_r
__P((double, int *));
203 #endif /* _REENTRANT */
204 #endif /* !_XOPEN_SOURCE */
205 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
208 #endif /* _MATH_H_ */