|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1995 by NeXT Computer, Inc. All rights reserved. */
26: /*
27: * ====================================================
28: * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
29: *
30: * Developed at SunPro, a Sun Microsystems, Inc. business.
31: * Permission to use, copy, modify, and distribute this
32: * software is freely granted, provided that this notice
33: * is preserved.
34: * ====================================================
35: */
36:
37: #ifndef _MATH_H_
38: #define _MATH_H_
39:
40: /*
41: * ANSI/POSIX
42: */
43: #define HUGE_VAL 1e500 /* IEEE: positive infinity */
44:
45: /*
46: * XOPEN/SVID
47: */
48: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
49: #define M_E 2.7182818284590452354 /* e */
50: #define M_LOG2E 1.4426950408889634074 /* log 2e */
51: #define M_LOG10E 0.43429448190325182765 /* log 10e */
52: #define M_LN2 0.69314718055994530942 /* log e2 */
53: #define M_LN10 2.30258509299404568402 /* log e10 */
54: #define M_PI 3.14159265358979323846 /* pi */
55: #define M_PI_2 1.57079632679489661923 /* pi/2 */
56: #define M_PI_4 0.78539816339744830962 /* pi/4 */
57: #define M_1_PI 0.31830988618379067154 /* 1/pi */
58: #define M_2_PI 0.63661977236758134308 /* 2/pi */
59: #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
60: #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
61: #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
62:
63: #define MAXFLOAT ((float)3.40282346638528860e+38)
64: extern int signgam;
65:
66: #if !defined(_XOPEN_SOURCE)
67: enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
68:
69: #define _LIB_VERSION_TYPE enum fdversion
70: #define _LIB_VERSION _fdlib_version
71:
72: /* if global variable _LIB_VERSION is not desirable, one may
73: * change the following to be a constant by:
74: * #define _LIB_VERSION_TYPE const enum version
75: * In that case, after one initializes the value _LIB_VERSION (see
76: * s_lib_version.c) during compile time, it cannot be modified
77: * in the middle of a program
78: */
79: extern _LIB_VERSION_TYPE _LIB_VERSION;
80:
81: #define _IEEE_ fdlibm_ieee
82: #define _SVID_ fdlibm_svid
83: #define _XOPEN_ fdlibm_xopen
84: #define _POSIX_ fdlibm_posix
85:
86: struct exception {
87: int type;
88: char *name;
89: double arg1;
90: double arg2;
91: double retval;
92: };
93:
94: #define HUGE MAXFLOAT
95:
96: /*
97: * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
98: * (one may replace the following line by "#include <values.h>")
99: */
100:
101: #define X_TLOSS 1.41484755040568800000e+16
102:
103: #define DOMAIN 1
104: #define SING 2
105: #define OVERFLOW 3
106: #define UNDERFLOW 4
107: #define TLOSS 5
108: #define PLOSS 6
109:
110: #endif /* !_XOPEN_SOURCE */
111: #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
112:
113:
114: #include <sys/cdefs.h>
115: __BEGIN_DECLS
116: /*
117: * ANSI/POSIX
118: */
119: extern __pure double acos __P((double));
120: extern __pure double asin __P((double));
121: extern __pure double atan __P((double));
122: extern __pure double atan2 __P((double, double));
123: extern __pure double cos __P((double));
124: extern __pure double sin __P((double));
125: extern __pure double tan __P((double));
126:
127: extern __pure double cosh __P((double));
128: extern __pure double sinh __P((double));
129: extern __pure double tanh __P((double));
130:
131: extern __pure double exp __P((double));
132: extern double frexp __P((double, int *));
133: extern __pure double ldexp __P((double, int));
134: extern __pure double log __P((double));
135: extern __pure double log10 __P((double));
136: extern double modf __P((double, double *));
137:
138: extern __pure double pow __P((double, double));
139: extern __pure double sqrt __P((double));
140:
141: extern __pure double ceil __P((double));
142: extern __pure double fabs __P((double));
143: extern __pure double floor __P((double));
144: extern __pure double fmod __P((double, double));
145:
146: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
147: extern __pure double erf __P((double));
148: extern __pure double erfc __P((double));
149: extern double gamma __P((double));
150: extern __pure double hypot __P((double, double));
151: extern __pure int isinf __P((double));
152: extern __pure int isnan __P((double));
153: extern __pure int finite __P((double));
154: extern __pure double j0 __P((double));
155: extern __pure double j1 __P((double));
156: extern __pure double jn __P((int, double));
157: extern double lgamma __P((double));
158: extern __pure double y0 __P((double));
159: extern __pure double y1 __P((double));
160: extern __pure double yn __P((int, double));
161:
162: #if !defined(_XOPEN_SOURCE)
163: extern __pure double acosh __P((double));
164: extern __pure double asinh __P((double));
165: extern __pure double atanh __P((double));
166: extern __pure double cbrt __P((double));
167: extern __pure double logb __P((double));
168: extern __pure double nextafter __P((double, double));
169: extern __pure double remainder __P((double, double));
170: extern __pure double scalb __P((double, int));
171:
172: extern int matherr __P((struct exception *));
173:
174: /*
175: * IEEE Test Vector
176: */
177: extern __pure double significand __P((double));
178:
179: /*
180: * Functions callable from C, intended to support IEEE arithmetic.
181: */
182: extern __pure double copysign __P((double, double));
183: extern __pure int ilogb __P((double));
184: extern __pure double rint __P((double));
185: extern __pure double scalbn __P((double, int));
186:
187: /*
188: * BSD math library entry points
189: */
190: extern double cabs();
191: extern __pure double drem __P((double, double));
192: extern __pure double expm1 __P((double));
193: extern __pure double log1p __P((double));
194:
195: /*
196: * Reentrant version of gamma & lgamma; passes signgam back by reference
197: * as the second argument; user must allocate space for signgam.
198: */
199: #ifdef _REENTRANT
200: extern double gamma_r __P((double, int *));
201: extern double lgamma_r __P((double, int *));
202: #endif /* _REENTRANT */
203: #endif /* !_XOPEN_SOURCE */
204: #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
205: __END_DECLS
206:
207: #endif /* _MATH_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.