xref: /illumos-gate/usr/src/head/iso/math_iso.h (revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8)
1*25c28e83SPiotr Jasiukajtis /*
2*25c28e83SPiotr Jasiukajtis  * CDDL HEADER START
3*25c28e83SPiotr Jasiukajtis  *
4*25c28e83SPiotr Jasiukajtis  * The contents of this file are subject to the terms of the
5*25c28e83SPiotr Jasiukajtis  * Common Development and Distribution License (the "License").
6*25c28e83SPiotr Jasiukajtis  * You may not use this file except in compliance with the License.
7*25c28e83SPiotr Jasiukajtis  *
8*25c28e83SPiotr Jasiukajtis  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25c28e83SPiotr Jasiukajtis  * or http://www.opensolaris.org/os/licensing.
10*25c28e83SPiotr Jasiukajtis  * See the License for the specific language governing permissions
11*25c28e83SPiotr Jasiukajtis  * and limitations under the License.
12*25c28e83SPiotr Jasiukajtis  *
13*25c28e83SPiotr Jasiukajtis  * When distributing Covered Code, include this CDDL HEADER in each
14*25c28e83SPiotr Jasiukajtis  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25c28e83SPiotr Jasiukajtis  * If applicable, add the following below this CDDL HEADER, with the
16*25c28e83SPiotr Jasiukajtis  * fields enclosed by brackets "[]" replaced with your own identifying
17*25c28e83SPiotr Jasiukajtis  * information: Portions Copyright [yyyy] [name of copyright owner]
18*25c28e83SPiotr Jasiukajtis  *
19*25c28e83SPiotr Jasiukajtis  * CDDL HEADER END
20*25c28e83SPiotr Jasiukajtis  */
21*25c28e83SPiotr Jasiukajtis /*
22*25c28e83SPiotr Jasiukajtis  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
23*25c28e83SPiotr Jasiukajtis  */
24*25c28e83SPiotr Jasiukajtis /*
25*25c28e83SPiotr Jasiukajtis  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
26*25c28e83SPiotr Jasiukajtis  * Use is subject to license terms.
27*25c28e83SPiotr Jasiukajtis  */
28*25c28e83SPiotr Jasiukajtis 
29*25c28e83SPiotr Jasiukajtis #ifndef _ISO_MATH_ISO_H
30*25c28e83SPiotr Jasiukajtis #define	_ISO_MATH_ISO_H
31*25c28e83SPiotr Jasiukajtis 
32*25c28e83SPiotr Jasiukajtis #include <sys/feature_tests.h>
33*25c28e83SPiotr Jasiukajtis 
34*25c28e83SPiotr Jasiukajtis #ifdef __cplusplus
35*25c28e83SPiotr Jasiukajtis extern "C" {
36*25c28e83SPiotr Jasiukajtis #endif
37*25c28e83SPiotr Jasiukajtis 
38*25c28e83SPiotr Jasiukajtis #ifndef __P
39*25c28e83SPiotr Jasiukajtis #ifdef __STDC__
40*25c28e83SPiotr Jasiukajtis #define	__P(p)	p
41*25c28e83SPiotr Jasiukajtis #else
42*25c28e83SPiotr Jasiukajtis #define	__P(p)	()
43*25c28e83SPiotr Jasiukajtis #endif
44*25c28e83SPiotr Jasiukajtis #endif	/* !defined(__P) */
45*25c28e83SPiotr Jasiukajtis 
46*25c28e83SPiotr Jasiukajtis #if !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && !defined(__C99FEATURES__)
47*25c28e83SPiotr Jasiukajtis typedef union _h_val {
48*25c28e83SPiotr Jasiukajtis 	unsigned long _i[sizeof (double) / sizeof (unsigned long)];
49*25c28e83SPiotr Jasiukajtis 	double _d;
50*25c28e83SPiotr Jasiukajtis } _h_val;
51*25c28e83SPiotr Jasiukajtis 
52*25c28e83SPiotr Jasiukajtis #ifdef __STDC__
53*25c28e83SPiotr Jasiukajtis extern const _h_val __huge_val;
54*25c28e83SPiotr Jasiukajtis #else
55*25c28e83SPiotr Jasiukajtis extern _h_val __huge_val;
56*25c28e83SPiotr Jasiukajtis #endif
57*25c28e83SPiotr Jasiukajtis #undef	HUGE_VAL
58*25c28e83SPiotr Jasiukajtis #define	HUGE_VAL __huge_val._d
59*25c28e83SPiotr Jasiukajtis #endif	/* !defined(_STDC_C99) && _XOPEN_SOURCE - 0 < 600 && ... */
60*25c28e83SPiotr Jasiukajtis 
61*25c28e83SPiotr Jasiukajtis #if __cplusplus >= 199711L
62*25c28e83SPiotr Jasiukajtis namespace std {
63*25c28e83SPiotr Jasiukajtis #endif
64*25c28e83SPiotr Jasiukajtis 
65*25c28e83SPiotr Jasiukajtis extern double acos __P((double));
66*25c28e83SPiotr Jasiukajtis extern double asin __P((double));
67*25c28e83SPiotr Jasiukajtis extern double atan __P((double));
68*25c28e83SPiotr Jasiukajtis extern double atan2 __P((double, double));
69*25c28e83SPiotr Jasiukajtis extern double cos __P((double));
70*25c28e83SPiotr Jasiukajtis extern double sin __P((double));
71*25c28e83SPiotr Jasiukajtis extern double tan __P((double));
72*25c28e83SPiotr Jasiukajtis 
73*25c28e83SPiotr Jasiukajtis extern double cosh __P((double));
74*25c28e83SPiotr Jasiukajtis extern double sinh __P((double));
75*25c28e83SPiotr Jasiukajtis extern double tanh __P((double));
76*25c28e83SPiotr Jasiukajtis 
77*25c28e83SPiotr Jasiukajtis extern double exp __P((double));
78*25c28e83SPiotr Jasiukajtis extern double frexp __P((double, int *));
79*25c28e83SPiotr Jasiukajtis extern double ldexp __P((double, int));
80*25c28e83SPiotr Jasiukajtis extern double log __P((double));
81*25c28e83SPiotr Jasiukajtis extern double log10 __P((double));
82*25c28e83SPiotr Jasiukajtis extern double modf __P((double, double *));
83*25c28e83SPiotr Jasiukajtis 
84*25c28e83SPiotr Jasiukajtis extern double pow __P((double, double));
85*25c28e83SPiotr Jasiukajtis extern double sqrt __P((double));
86*25c28e83SPiotr Jasiukajtis 
87*25c28e83SPiotr Jasiukajtis extern double ceil __P((double));
88*25c28e83SPiotr Jasiukajtis extern double fabs __P((double));
89*25c28e83SPiotr Jasiukajtis extern double floor __P((double));
90*25c28e83SPiotr Jasiukajtis extern double fmod __P((double, double));
91*25c28e83SPiotr Jasiukajtis 
92*25c28e83SPiotr Jasiukajtis #if defined(__MATHERR_ERRNO_DONTCARE)
93*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(acos, asin, atan, atan2)
94*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(cos, sin, tan, cosh, sinh, tanh)
95*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(exp, log, log10, pow, sqrt)
96*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(frexp, ldexp, modf)
97*25c28e83SPiotr Jasiukajtis #pragma does_not_read_global_data(ceil, fabs, floor, fmod)
98*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(acos, asin, atan, atan2)
99*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(cos, sin, tan, cosh, sinh, tanh)
100*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(exp, log, log10, pow, sqrt)
101*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(ldexp)
102*25c28e83SPiotr Jasiukajtis #pragma does_not_write_global_data(ceil, fabs, floor, fmod)
103*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(acos, asin, atan, atan2)
104*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(cos, sin, tan, cosh, sinh, tanh)
105*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(exp, log, log10, pow, sqrt)
106*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(ldexp)
107*25c28e83SPiotr Jasiukajtis #pragma no_side_effect(ceil, fabs, floor, fmod)
108*25c28e83SPiotr Jasiukajtis #endif
109*25c28e83SPiotr Jasiukajtis 
110*25c28e83SPiotr Jasiukajtis #if __cplusplus >= 199711L
111*25c28e83SPiotr Jasiukajtis extern float __acosf(float);
112*25c28e83SPiotr Jasiukajtis extern float __asinf(float);
113*25c28e83SPiotr Jasiukajtis extern float __atanf(float);
114*25c28e83SPiotr Jasiukajtis extern float __atan2f(float, float);
115*25c28e83SPiotr Jasiukajtis extern float __ceilf(float);
116*25c28e83SPiotr Jasiukajtis extern float __cosf(float);
117*25c28e83SPiotr Jasiukajtis extern float __coshf(float);
118*25c28e83SPiotr Jasiukajtis extern float __expf(float);
119*25c28e83SPiotr Jasiukajtis extern float __fabsf(float);
120*25c28e83SPiotr Jasiukajtis extern float __floorf(float);
121*25c28e83SPiotr Jasiukajtis extern float __fmodf(float, float);
122*25c28e83SPiotr Jasiukajtis extern float __frexpf(float, int *);
123*25c28e83SPiotr Jasiukajtis extern float __ldexpf(float, int);
124*25c28e83SPiotr Jasiukajtis extern float __logf(float);
125*25c28e83SPiotr Jasiukajtis extern float __log10f(float);
126*25c28e83SPiotr Jasiukajtis extern float __modff(float, float *);
127*25c28e83SPiotr Jasiukajtis extern float __powf(float, float);
128*25c28e83SPiotr Jasiukajtis extern float __sinf(float);
129*25c28e83SPiotr Jasiukajtis extern float __sinhf(float);
130*25c28e83SPiotr Jasiukajtis extern float __sqrtf(float);
131*25c28e83SPiotr Jasiukajtis extern float __tanf(float);
132*25c28e83SPiotr Jasiukajtis extern float __tanhf(float);
133*25c28e83SPiotr Jasiukajtis 
134*25c28e83SPiotr Jasiukajtis extern long double __acosl(long double);
135*25c28e83SPiotr Jasiukajtis extern long double __asinl(long double);
136*25c28e83SPiotr Jasiukajtis extern long double __atanl(long double);
137*25c28e83SPiotr Jasiukajtis extern long double __atan2l(long double, long double);
138*25c28e83SPiotr Jasiukajtis extern long double __ceill(long double);
139*25c28e83SPiotr Jasiukajtis extern long double __cosl(long double);
140*25c28e83SPiotr Jasiukajtis extern long double __coshl(long double);
141*25c28e83SPiotr Jasiukajtis extern long double __expl(long double);
142*25c28e83SPiotr Jasiukajtis extern long double __fabsl(long double);
143*25c28e83SPiotr Jasiukajtis extern long double __floorl(long double);
144*25c28e83SPiotr Jasiukajtis extern long double __fmodl(long double, long double);
145*25c28e83SPiotr Jasiukajtis extern long double __frexpl(long double, int *);
146*25c28e83SPiotr Jasiukajtis extern long double __ldexpl(long double, int);
147*25c28e83SPiotr Jasiukajtis extern long double __logl(long double);
148*25c28e83SPiotr Jasiukajtis extern long double __log10l(long double);
149*25c28e83SPiotr Jasiukajtis extern long double __modfl(long double, long double *);
150*25c28e83SPiotr Jasiukajtis extern long double __powl(long double, long double);
151*25c28e83SPiotr Jasiukajtis extern long double __sinl(long double);
152*25c28e83SPiotr Jasiukajtis extern long double __sinhl(long double);
153*25c28e83SPiotr Jasiukajtis extern long double __sqrtl(long double);
154*25c28e83SPiotr Jasiukajtis extern long double __tanl(long double);
155*25c28e83SPiotr Jasiukajtis extern long double __tanhl(long double);
156*25c28e83SPiotr Jasiukajtis 
157*25c28e83SPiotr Jasiukajtis extern "C++" {
158*25c28e83SPiotr Jasiukajtis #undef	__X
159*25c28e83SPiotr Jasiukajtis #undef	__Y
160*25c28e83SPiotr Jasiukajtis 	inline double abs(double __X) { return fabs(__X); }
161*25c28e83SPiotr Jasiukajtis 	inline double pow(double __X, int __Y) { return
162*25c28e83SPiotr Jasiukajtis 		pow(__X, (double) (__Y)); }
163*25c28e83SPiotr Jasiukajtis 
164*25c28e83SPiotr Jasiukajtis 	inline float abs(float __X) { return __fabsf(__X); }
165*25c28e83SPiotr Jasiukajtis 	inline float acos(float __X) { return __acosf(__X); }
166*25c28e83SPiotr Jasiukajtis 	inline float asin(float __X) { return __asinf(__X); }
167*25c28e83SPiotr Jasiukajtis 	inline float atan(float __X) { return __atanf(__X); }
168*25c28e83SPiotr Jasiukajtis 	inline float atan2(float __X, float __Y) { return __atan2f(__X, __Y); }
169*25c28e83SPiotr Jasiukajtis 	inline float ceil(float __X) { return __ceilf(__X); }
170*25c28e83SPiotr Jasiukajtis 	inline float cos(float __X) { return __cosf(__X); }
171*25c28e83SPiotr Jasiukajtis 	inline float cosh(float __X) { return __coshf(__X); }
172*25c28e83SPiotr Jasiukajtis 	inline float exp(float __X) { return __expf(__X); }
173*25c28e83SPiotr Jasiukajtis 	inline float fabs(float __X) { return __fabsf(__X); }
174*25c28e83SPiotr Jasiukajtis 	inline float floor(float __X) { return __floorf(__X); }
175*25c28e83SPiotr Jasiukajtis 	inline float fmod(float __X, float __Y) { return __fmodf(__X, __Y); }
176*25c28e83SPiotr Jasiukajtis 	inline float frexp(float __X, int *__Y) { return __frexpf(__X, __Y); }
177*25c28e83SPiotr Jasiukajtis 	inline float ldexp(float __X, int __Y) { return __ldexpf(__X, __Y); }
178*25c28e83SPiotr Jasiukajtis 	inline float log(float __X) { return __logf(__X); }
179*25c28e83SPiotr Jasiukajtis 	inline float log10(float __X) { return __log10f(__X); }
180*25c28e83SPiotr Jasiukajtis 	inline float modf(float __X, float *__Y) { return __modff(__X, __Y); }
181*25c28e83SPiotr Jasiukajtis 	inline float pow(float __X, float __Y) { return __powf(__X, __Y); }
182*25c28e83SPiotr Jasiukajtis 	inline float pow(float __X, int __Y) { return
183*25c28e83SPiotr Jasiukajtis 		pow((double) (__X), (double) (__Y)); }
184*25c28e83SPiotr Jasiukajtis 	inline float sin(float __X) { return __sinf(__X); }
185*25c28e83SPiotr Jasiukajtis 	inline float sinh(float __X) { return __sinhf(__X); }
186*25c28e83SPiotr Jasiukajtis 	inline float sqrt(float __X) { return __sqrtf(__X); }
187*25c28e83SPiotr Jasiukajtis 	inline float tan(float __X) { return __tanf(__X); }
188*25c28e83SPiotr Jasiukajtis 	inline float tanh(float __X) { return __tanhf(__X); }
189*25c28e83SPiotr Jasiukajtis 
190*25c28e83SPiotr Jasiukajtis 	inline long double abs(long double __X) { return __fabsl(__X); }
191*25c28e83SPiotr Jasiukajtis 	inline long double acos(long double __X) { return __acosl(__X); }
192*25c28e83SPiotr Jasiukajtis 	inline long double asin(long double __X) { return __asinl(__X); }
193*25c28e83SPiotr Jasiukajtis 	inline long double atan(long double __X) { return __atanl(__X); }
194*25c28e83SPiotr Jasiukajtis 	inline long double atan2(long double __X, long double __Y) { return
195*25c28e83SPiotr Jasiukajtis 		__atan2l(__X, __Y); }
196*25c28e83SPiotr Jasiukajtis 	inline long double ceil(long double __X) { return __ceill(__X); }
197*25c28e83SPiotr Jasiukajtis 	inline long double cos(long double __X) { return __cosl(__X); }
198*25c28e83SPiotr Jasiukajtis 	inline long double cosh(long double __X) { return __coshl(__X); }
199*25c28e83SPiotr Jasiukajtis 	inline long double exp(long double __X) { return __expl(__X); }
200*25c28e83SPiotr Jasiukajtis 	inline long double fabs(long double __X) { return __fabsl(__X); }
201*25c28e83SPiotr Jasiukajtis 	inline long double floor(long double __X) { return __floorl(__X); }
202*25c28e83SPiotr Jasiukajtis 	inline long double fmod(long double __X, long double __Y) { return
203*25c28e83SPiotr Jasiukajtis 		__fmodl(__X, __Y); }
204*25c28e83SPiotr Jasiukajtis 	inline long double frexp(long double __X, int *__Y) { return
205*25c28e83SPiotr Jasiukajtis 		__frexpl(__X, __Y); }
206*25c28e83SPiotr Jasiukajtis 	inline long double ldexp(long double __X, int __Y) { return
207*25c28e83SPiotr Jasiukajtis 		__ldexpl(__X, __Y); }
208*25c28e83SPiotr Jasiukajtis 	inline long double log(long double __X) { return __logl(__X); }
209*25c28e83SPiotr Jasiukajtis 	inline long double log10(long double __X) { return __log10l(__X); }
210*25c28e83SPiotr Jasiukajtis 	inline long double modf(long double __X, long double *__Y) { return
211*25c28e83SPiotr Jasiukajtis 		__modfl(__X, __Y); }
212*25c28e83SPiotr Jasiukajtis 	inline long double pow(long double __X, long double __Y) { return
213*25c28e83SPiotr Jasiukajtis 		__powl(__X, __Y); }
214*25c28e83SPiotr Jasiukajtis 	inline long double pow(long double __X, int __Y) { return
215*25c28e83SPiotr Jasiukajtis 		__powl(__X, (long double) (__Y)); }
216*25c28e83SPiotr Jasiukajtis 	inline long double sin(long double __X) { return __sinl(__X); }
217*25c28e83SPiotr Jasiukajtis 	inline long double sinh(long double __X) { return __sinhl(__X); }
218*25c28e83SPiotr Jasiukajtis 	inline long double sqrt(long double __X) { return __sqrtl(__X); }
219*25c28e83SPiotr Jasiukajtis 	inline long double tan(long double __X) { return __tanl(__X); }
220*25c28e83SPiotr Jasiukajtis 	inline long double tanh(long double __X) { return __tanhl(__X); }
221*25c28e83SPiotr Jasiukajtis }	/* end of extern "C++" */
222*25c28e83SPiotr Jasiukajtis #endif	/* __cplusplus >= 199711L */
223*25c28e83SPiotr Jasiukajtis 
224*25c28e83SPiotr Jasiukajtis #if __cplusplus >= 199711L
225*25c28e83SPiotr Jasiukajtis }	/* end of namespace std */
226*25c28e83SPiotr Jasiukajtis #endif
227*25c28e83SPiotr Jasiukajtis 
228*25c28e83SPiotr Jasiukajtis #ifdef __cplusplus
229*25c28e83SPiotr Jasiukajtis }
230*25c28e83SPiotr Jasiukajtis #endif
231*25c28e83SPiotr Jasiukajtis 
232*25c28e83SPiotr Jasiukajtis #endif	/* _ISO_MATH_ISO_H */
233