]> sourceware.org Git - newlib-cygwin.git/blame - newlib/libc/include/math.h
Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2
[newlib-cygwin.git] / newlib / libc / include / math.h
CommitLineData
8a0efa53 1#ifndef _MATH_H_
c4ccbcce 2
8a0efa53
CF
3#define _MATH_H_
4
5#include <sys/reent.h>
4e8291b8 6#include <sys/cdefs.h>
8a0efa53
CF
7#include <machine/ieeefp.h>
8#include "_ansi.h"
9
c1a3171f
JJ
10_BEGIN_STD_C
11
78e66fb9 12/* Natural log of 2 */
fd451503 13#define _M_LN2 0.693147180559945309417
6494ee83 14
5eceb395 15#if __GNUC_PREREQ (3, 3)
09968b6d
JJ
16 /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
17
895d76fe
EB
18# ifndef HUGE_VAL
19# define HUGE_VAL (__builtin_huge_val())
20# endif
09968b6d 21
895d76fe
EB
22# ifndef HUGE_VALF
23# define HUGE_VALF (__builtin_huge_valf())
24# endif
09968b6d 25
895d76fe
EB
26# ifndef HUGE_VALL
27# define HUGE_VALL (__builtin_huge_vall())
28# endif
29
30# ifndef INFINITY
31# define INFINITY (__builtin_inff())
32# endif
33
34# ifndef NAN
35# define NAN (__builtin_nanf(""))
36# endif
09968b6d
JJ
37
38#else /* !gcc >= 3.3 */
39
de8a5b78
JJ
40 /* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY
41 * and NAN macros are required to be constant expressions. Using a variable--
42 * even a static const--does not meet this requirement, as it cannot be
43 * evaluated at translation time.)
44 * The infinities are done using numbers that are far in excess of
45 * something that would be expected to be encountered in a floating-point
46 * implementation. (A more certain way uses values from float.h, but that is
47 * avoided because system includes are not supposed to include each other.)
48 * This method might produce warnings from some compilers. (It does in
49 * newer GCCs, but not for ones that would hit this #else.) If this happens,
50 * please report details to the Newlib mailing list. */
09968b6d
JJ
51
52 #ifndef HUGE_VAL
de8a5b78 53 #define HUGE_VAL (1.0e999999999)
09968b6d
JJ
54 #endif
55
56 #ifndef HUGE_VALF
de8a5b78
JJ
57 #define HUGE_VALF (1.0e999999999F)
58 #endif
59
60 #if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE)
61 #define HUGE_VALL (1.0e999999999L)
62 #endif
63
64 #if !defined(INFINITY)
65 #define INFINITY (HUGE_VALF)
09968b6d 66 #endif
7c110b17 67
de8a5b78
JJ
68 #if !defined(NAN)
69 #if defined(__GNUC__) && defined(__cplusplus)
70 /* Exception: older g++ versions warn about the divide by 0 used in the
71 * normal case (even though older gccs do not). This trick suppresses the
72 * warning, but causes errors for plain gcc, so is only used in the one
73 * special case. */
74 static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000};
75 #define NAN (__Nanf.__d)
76 #else
77 #define NAN (0.0F/0.0F)
78 #endif
09968b6d 79 #endif
8a0efa53 80
09968b6d 81#endif /* !gcc >= 3.3 */
8a0efa53
CF
82
83/* Reentrant ANSI C functions. */
84
85#ifndef __math_68881
eea249da
YS
86extern double atan (double);
87extern double cos (double);
88extern double sin (double);
89extern double tan (double);
90extern double tanh (double);
91extern double frexp (double, int *);
92extern double modf (double, double *);
93extern double ceil (double);
94extern double fabs (double);
95extern double floor (double);
8a0efa53
CF
96#endif /* ! defined (__math_68881) */
97
98/* Non reentrant ANSI C functions. */
99
100#ifndef _REENT_ONLY
823f6f66 101#ifndef __math_68881
eea249da
YS
102extern double acos (double);
103extern double asin (double);
104extern double atan2 (double, double);
105extern double cosh (double);
106extern double sinh (double);
107extern double exp (double);
108extern double ldexp (double, int);
109extern double log (double);
110extern double log10 (double);
111extern double pow (double, double);
112extern double sqrt (double);
113extern double fmod (double, double);
8a0efa53
CF
114#endif /* ! defined (__math_68881) */
115#endif /* ! defined (_REENT_ONLY) */
116
722e363c 117#if __MISC_VISIBLE
eea249da
YS
118extern int finite (double);
119extern int finitef (float);
120extern int finitel (long double);
121extern int isinff (float);
122extern int isnanf (float);
722e363c 123#ifdef __CYGWIN__ /* not implemented in newlib yet */
eea249da
YS
124extern int isinfl (long double);
125extern int isnanl (long double);
722e363c
YS
126#endif
127#if !defined(__cplusplus) || __cplusplus < 201103L
eea249da 128extern int isinf (double);
722e363c
YS
129#endif
130#endif /* __MISC_VISIBLE */
131#if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \
132 && (!defined(__cplusplus) || __cplusplus < 201103L)
eea249da 133extern int isnan (double);
722e363c
YS
134#endif
135
4e8291b8 136#if __ISO_C_VISIBLE >= 1999
0953fe64
TF
137/* ISO C99 types and macros. */
138
b060af22
JJ
139/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard,
140 * considering that the standard says the includes it defines should not
141 * include other includes that it defines) and that value used. (This can be
142 * solved, but autoconf has a bug which makes the solution more difficult, so
143 * it has been skipped for now.) */
144#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
145 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
146 #define __TMP_FLT_EVAL_METHOD
0953fe64 147#endif /* FLT_EVAL_METHOD */
b060af22 148#if defined FLT_EVAL_METHOD
91f99d32
KC
149/* FLT_EVAL_METHOD == 16 has meaning as defined in ISO/IEC TS 18661-3,
150 * which provides non-compliant extensions to C and POSIX (by adding
151 * additional positive values for FLT_EVAL_METHOD). It effectively has
152 * same meaning as the C99 and C11 definitions for value 0, while also
153 * serving as a flag that the _Float16 (float16_t) type exists.
154 *
155 * FLT_EVAL_METHOD could be any number of bits of supported floating point
156 * format (e.g. 32, 64, 128), but currently only AArch64 and few other targets
157 * might define that as 16. */
158 #if (FLT_EVAL_METHOD == 0) \
159 || (FLT_EVAL_METHOD == 16)
b060af22
JJ
160 typedef float float_t;
161 typedef double double_t;
162 #elif FLT_EVAL_METHOD == 1
163 typedef double float_t;
164 typedef double double_t;
165 #elif FLT_EVAL_METHOD == 2
166 typedef long double float_t;
167 typedef long double double_t;
168 #else
169 /* Implementation-defined. Assume float_t and double_t have been
170 * defined previously for this configuration (e.g. config.h). */
27f0913c
AC
171
172 /* If __DOUBLE_TYPE is defined (__FLOAT_TYPE is then supposed to be
173 defined as well) float_t and double_t definition is suggested by
174 an arch specific header. */
175 #ifdef __DOUBLE_TYPE
176 typedef __DOUBLE_TYPE double_t;
177 typedef __FLOAT_TYPE float_t;
178 #endif
179 /* Assume config.h has provided these types. */
b060af22
JJ
180 #endif
181#else
182 /* Assume basic definitions. */
183 typedef float float_t;
184 typedef double double_t;
185#endif
186#if defined(__TMP_FLT_EVAL_METHOD)
187 #undef FLT_EVAL_METHOD
188#endif
0953fe64
TF
189
190#define FP_NAN 0
191#define FP_INFINITE 1
192#define FP_ZERO 2
193#define FP_SUBNORMAL 3
194#define FP_NORMAL 4
195
895d76fe 196#ifndef FP_ILOGB0
357da5bc 197# define FP_ILOGB0 (-__INT_MAX__)
895d76fe
EB
198#endif
199#ifndef FP_ILOGBNAN
357da5bc 200# define FP_ILOGBNAN __INT_MAX__
895d76fe
EB
201#endif
202
203#ifndef MATH_ERRNO
204# define MATH_ERRNO 1
205#endif
206#ifndef MATH_ERREXCEPT
207# define MATH_ERREXCEPT 2
208#endif
209#ifndef math_errhandling
45efe659
KPN
210# ifdef _IEEE_LIBM
211# define _MATH_ERRHANDLING_ERRNO 0
212# else
213# define _MATH_ERRHANDLING_ERRNO MATH_ERRNO
214# endif
215# ifdef _SUPPORTS_ERREXCEPT
216# define _MATH_ERRHANDLING_ERREXCEPT MATH_ERREXCEPT
217# else
218# define _MATH_ERRHANDLING_ERREXCEPT 0
219# endif
220# define math_errhandling (_MATH_ERRHANDLING_ERRNO | _MATH_ERRHANDLING_ERREXCEPT)
895d76fe
EB
221#endif
222
4c49accf
CL
223extern int __isinff (float);
224extern int __isinfd (double);
225extern int __isnanf (float);
226extern int __isnand (double);
227extern int __fpclassifyf (float);
228extern int __fpclassifyd (double);
229extern int __signbitf (float);
230extern int __signbitd (double);
0953fe64 231
e48682cf
JJ
232/* Note: isinf and isnan were once functions in newlib that took double
233 * arguments. C99 specifies that these names are reserved for macros
234 * supporting multiple floating point types. Thus, they are
235 * now defined as macros. Implementations of the old functions
664f0076 236 * taking double arguments still exist for compatibility purposes
cd84d1c2 237 * (prototypes for them are earlier in this header). */
976e9d28 238
799fdda4
CV
239#if __GNUC_PREREQ (4, 4)
240 #define fpclassify(__x) (__builtin_fpclassify (FP_NAN, FP_INFINITE, \
241 FP_NORMAL, FP_SUBNORMAL, \
242 FP_ZERO, __x))
243 #ifndef isfinite
244 #define isfinite(__x) (__builtin_isfinite (__x))
245 #endif
246 #ifndef isinf
247 #define isinf(__x) (__builtin_isinf_sign (__x))
248 #endif
249 #ifndef isnan
250 #define isnan(__x) (__builtin_isnan (__x))
251 #endif
252 #define isnormal(__x) (__builtin_isnormal (__x))
253#else
254 #define fpclassify(__x) \
255 ((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
256 __fpclassifyd(__x))
257 #ifndef isfinite
258 #define isfinite(__y) \
259 (__extension__ ({int __cy = fpclassify(__y); \
260 __cy != FP_INFINITE && __cy != FP_NAN;}))
261 #endif
262 #ifndef isinf
263 #define isinf(__x) (fpclassify(__x) == FP_INFINITE)
264 #endif
265 #ifndef isnan
266 #define isnan(__x) (fpclassify(__x) == FP_NAN)
267 #endif
268 #define isnormal(__x) (fpclassify(__x) == FP_NORMAL)
976e9d28
JJ
269#endif
270
799fdda4
CV
271#if __GNUC_PREREQ (4, 0)
272 #if defined(_HAVE_LONG_DOUBLE)
273 #define signbit(__x) \
274 ((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
275 (sizeof(__x) == sizeof(double)) ? __builtin_signbit (__x) : \
276 __builtin_signbitl(__x))
277 #else
278 #define signbit(__x) \
279 ((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
280 __builtin_signbit (__x))
281 #endif
282#else
283 #define signbit(__x) \
284 ((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
285 __signbitd(__x))
286#endif
0953fe64 287
799fdda4
CV
288#if __GNUC_PREREQ (2, 97)
289#define isgreater(__x,__y) (__builtin_isgreater (__x, __y))
290#define isgreaterequal(__x,__y) (__builtin_isgreaterequal (__x, __y))
291#define isless(__x,__y) (__builtin_isless (__x, __y))
292#define islessequal(__x,__y) (__builtin_islessequal (__x, __y))
293#define islessgreater(__x,__y) (__builtin_islessgreater (__x, __y))
294#define isunordered(__x,__y) (__builtin_isunordered (__x, __y))
295#else
0953fe64
TF
296#define isgreater(x,y) \
297 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
298 !isunordered(__x,__y) && (__x > __y);}))
299#define isgreaterequal(x,y) \
300 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
301 !isunordered(__x,__y) && (__x >= __y);}))
302#define isless(x,y) \
303 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
304 !isunordered(__x,__y) && (__x < __y);}))
305#define islessequal(x,y) \
306 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
307 !isunordered(__x,__y) && (__x <= __y);}))
308#define islessgreater(x,y) \
309 (__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
310 !isunordered(__x,__y) && (__x < __y || __x > __y);}))
311
b59cab1e
JJ
312#define isunordered(a,b) \
313 (__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
314 fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
799fdda4 315#endif
0953fe64 316
8a0efa53
CF
317/* Non ANSI double precision functions. */
318
eea249da
YS
319extern double infinity (void);
320extern double nan (const char *);
321extern double copysign (double, double);
322extern double logb (double);
323extern int ilogb (double);
324
325extern double asinh (double);
326extern double cbrt (double);
327extern double nextafter (double, double);
328extern double rint (double);
329extern double scalbn (double, int);
330
331extern double exp2 (double);
332extern double scalbln (double, long int);
333extern double tgamma (double);
334extern double nearbyint (double);
335extern long int lrint (double);
336extern long long int llrint (double);
337extern double round (double);
338extern long int lround (double);
339extern long long int llround (double);
340extern double trunc (double);
341extern double remquo (double, double, int *);
342extern double fdim (double, double);
343extern double fmax (double, double);
344extern double fmin (double, double);
345extern double fma (double, double, double);
e0500490 346
8a0efa53 347#ifndef __math_68881
eea249da
YS
348extern double log1p (double);
349extern double expm1 (double);
8a0efa53
CF
350#endif /* ! defined (__math_68881) */
351
352#ifndef _REENT_ONLY
eea249da
YS
353extern double acosh (double);
354extern double atanh (double);
355extern double remainder (double, double);
356extern double gamma (double);
357extern double lgamma (double);
358extern double erf (double);
359extern double erfc (double);
360extern double log2 (double);
d8a43935 361#if !defined(__cplusplus)
fd451503 362#define log2(x) (log (x) / _M_LN2)
d8a43935 363#endif
8a0efa53
CF
364
365#ifndef __math_68881
eea249da 366extern double hypot (double, double);
8a0efa53
CF
367#endif
368
8a0efa53
CF
369#endif /* ! defined (_REENT_ONLY) */
370
371/* Single precision versions of ANSI functions. */
372
eea249da
YS
373extern float atanf (float);
374extern float cosf (float);
375extern float sinf (float);
376extern float tanf (float);
377extern float tanhf (float);
378extern float frexpf (float, int *);
379extern float modff (float, float *);
380extern float ceilf (float);
381extern float fabsf (float);
382extern float floorf (float);
8a0efa53
CF
383
384#ifndef _REENT_ONLY
eea249da
YS
385extern float acosf (float);
386extern float asinf (float);
387extern float atan2f (float, float);
388extern float coshf (float);
389extern float sinhf (float);
390extern float expf (float);
391extern float ldexpf (float, int);
392extern float logf (float);
393extern float log10f (float);
394extern float powf (float, float);
395extern float sqrtf (float);
396extern float fmodf (float, float);
8a0efa53
CF
397#endif /* ! defined (_REENT_ONLY) */
398
399/* Other single precision functions. */
400
eea249da
YS
401extern float exp2f (float);
402extern float scalblnf (float, long int);
403extern float tgammaf (float);
404extern float nearbyintf (float);
405extern long int lrintf (float);
406extern long long int llrintf (float);
407extern float roundf (float);
408extern long int lroundf (float);
409extern long long int llroundf (float);
410extern float truncf (float);
411extern float remquof (float, float, int *);
412extern float fdimf (float, float);
413extern float fmaxf (float, float);
414extern float fminf (float, float);
415extern float fmaf (float, float, float);
416
417extern float infinityf (void);
418extern float nanf (const char *);
419extern float copysignf (float, float);
420extern float logbf (float);
421extern int ilogbf (float);
422
423extern float asinhf (float);
424extern float cbrtf (float);
425extern float nextafterf (float, float);
426extern float rintf (float);
427extern float scalbnf (float, int);
428extern float log1pf (float);
429extern float expm1f (float);
e0500490 430
8a0efa53 431#ifndef _REENT_ONLY
eea249da
YS
432extern float acoshf (float);
433extern float atanhf (float);
434extern float remainderf (float, float);
435extern float gammaf (float);
436extern float lgammaf (float);
437extern float erff (float);
438extern float erfcf (float);
439extern float log2f (float);
440extern float hypotf (float, float);
c4ccbcce
JJ
441#endif /* ! defined (_REENT_ONLY) */
442
792e51b7
CV
443/* Newlib doesn't fully support long double math functions so far.
444 On platforms where long double equals double the long double functions
445 simply call the double functions. On Cygwin the long double functions
446 are implemented independently from newlib to be able to use optimized
447 assembler functions despite using the Microsoft x86_64 ABI. */
448#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
65f414dc
JJ
449/* Reentrant ANSI C functions. */
450#ifndef __math_68881
eea249da
YS
451extern long double atanl (long double);
452extern long double cosl (long double);
453extern long double sinl (long double);
454extern long double tanl (long double);
455extern long double tanhl (long double);
456extern long double frexpl (long double, int *);
457extern long double modfl (long double, long double *);
458extern long double ceill (long double);
459extern long double fabsl (long double);
460extern long double floorl (long double);
461extern long double log1pl (long double);
462extern long double expm1l (long double);
65f414dc
JJ
463#endif /* ! defined (__math_68881) */
464/* Non reentrant ANSI C functions. */
465#ifndef _REENT_ONLY
466#ifndef __math_68881
eea249da
YS
467extern long double acosl (long double);
468extern long double asinl (long double);
469extern long double atan2l (long double, long double);
470extern long double coshl (long double);
471extern long double sinhl (long double);
472extern long double expl (long double);
473extern long double ldexpl (long double, int);
474extern long double logl (long double);
475extern long double log10l (long double);
476extern long double powl (long double, long double);
477extern long double sqrtl (long double);
478extern long double fmodl (long double, long double);
479extern long double hypotl (long double, long double);
65f414dc
JJ
480#endif /* ! defined (__math_68881) */
481#endif /* ! defined (_REENT_ONLY) */
eea249da
YS
482extern long double copysignl (long double, long double);
483extern long double nanl (const char *);
484extern int ilogbl (long double);
485extern long double asinhl (long double);
486extern long double cbrtl (long double);
487extern long double nextafterl (long double, long double);
488extern float nexttowardf (float, long double);
489extern double nexttoward (double, long double);
490extern long double nexttowardl (long double, long double);
491extern long double logbl (long double);
492extern long double log2l (long double);
493extern long double rintl (long double);
494extern long double scalbnl (long double, int);
495extern long double exp2l (long double);
496extern long double scalblnl (long double, long);
497extern long double tgammal (long double);
498extern long double nearbyintl (long double);
499extern long int lrintl (long double);
500extern long long int llrintl (long double);
501extern long double roundl (long double);
502extern long lroundl (long double);
503extern long long int llroundl (long double);
504extern long double truncl (long double);
505extern long double remquol (long double, long double, int *);
506extern long double fdiml (long double, long double);
507extern long double fmaxl (long double, long double);
508extern long double fminl (long double, long double);
509extern long double fmal (long double, long double, long double);
65f414dc 510#ifndef _REENT_ONLY
eea249da
YS
511extern long double acoshl (long double);
512extern long double atanhl (long double);
513extern long double remainderl (long double, long double);
514extern long double lgammal (long double);
515extern long double erfl (long double);
516extern long double erfcl (long double);
65f414dc 517#endif /* ! defined (_REENT_ONLY) */
792e51b7 518#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
eea249da
YS
519extern long double hypotl (long double, long double);
520extern long double sqrtl (long double);
48f6c593 521extern long double frexpl (long double, int *);
823f6f66 522#ifdef __i386__
65f414dc 523/* Other long double precision functions. */
eea249da
YS
524extern _LONG_DOUBLE rintl (_LONG_DOUBLE);
525extern long int lrintl (_LONG_DOUBLE);
526extern long long int llrintl (_LONG_DOUBLE);
823f6f66 527#endif /* __i386__ */
792e51b7 528#endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
3cc8a378 529
4e8291b8 530#endif /* __ISO_C_VISIBLE >= 1999 */
c4ccbcce 531
4e8291b8 532#if __MISC_VISIBLE
eea249da
YS
533extern double drem (double, double);
534extern float dremf (float, float);
792e51b7 535#ifdef __CYGWIN__
eea249da 536extern float dreml (long double, long double);
792e51b7 537#endif /* __CYGWIN__ */
eea249da
YS
538extern double gamma_r (double, int *);
539extern double lgamma_r (double, int *);
540extern float gammaf_r (float, int *);
541extern float lgammaf_r (float, int *);
4e8291b8 542#endif
c4ccbcce 543
4e8291b8 544#if __MISC_VISIBLE || __XSI_VISIBLE
eea249da
YS
545extern double y0 (double);
546extern double y1 (double);
547extern double yn (int, double);
548extern double j0 (double);
549extern double j1 (double);
550extern double jn (int, double);
4e8291b8 551#endif
c4ccbcce 552
4e8291b8 553#if __MISC_VISIBLE || __XSI_VISIBLE >= 600
eea249da
YS
554extern float y0f (float);
555extern float y1f (float);
556extern float ynf (int, float);
557extern float j0f (float);
558extern float j1f (float);
559extern float jnf (int, float);
4e8291b8 560#endif
8a0efa53 561
c4ccbcce 562/* GNU extensions */
4e8291b8 563#if __GNU_VISIBLE
eea249da
YS
564extern void sincos (double, double *, double *);
565extern void sincosf (float, float *, float *);
792e51b7 566#ifdef __CYGWIN__
eea249da 567extern void sincosl (long double, long double *, long double *);
792e51b7 568#endif /* __CYGWIN__ */
c4ccbcce 569# ifndef exp10
eea249da 570extern double exp10 (double);
c4ccbcce
JJ
571# endif
572# ifndef pow10
eea249da 573extern double pow10 (double);
c4ccbcce
JJ
574# endif
575# ifndef exp10f
eea249da 576extern float exp10f (float);
c4ccbcce
JJ
577# endif
578# ifndef pow10f
eea249da 579extern float pow10f (float);
c4ccbcce 580# endif
792e51b7
CV
581#ifdef __CYGWIN__
582# ifndef exp10l
eea249da 583extern float exp10l (float);
792e51b7
CV
584# endif
585# ifndef pow10l
eea249da 586extern float pow10l (float);
792e51b7
CV
587# endif
588#endif /* __CYGWIN__ */
4e8291b8 589#endif /* __GNU_VISIBLE */
8a0efa53 590
4e8291b8 591#if __MISC_VISIBLE || __XSI_VISIBLE
8a0efa53 592/* The gamma functions use a global variable, signgam. */
3aaa66f8
JJ
593#ifndef _REENT_ONLY
594#define signgam (*__signgam())
eea249da 595extern int *__signgam (void);
3aaa66f8 596#endif /* ! defined (_REENT_ONLY) */
8a0efa53 597
8195aff7 598#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
4e8291b8 599#endif /* __MISC_VISIBLE || __XSI_VISIBLE */
8a0efa53 600
8a0efa53
CF
601/* Useful constants. */
602
52d940e2 603#if __BSD_VISIBLE || __XSI_VISIBLE
a4a96eb4 604
6aec558e
JJ
605#define MAXFLOAT 3.40282347e+38F
606
8a0efa53 607#define M_E 2.7182818284590452354
78e66fb9 608#define M_LOG2E 1.4426950408889634074
8a0efa53 609#define M_LOG10E 0.43429448190325182765
fd451503 610#define M_LN2 _M_LN2
8a0efa53
CF
611#define M_LN10 2.30258509299404568402
612#define M_PI 3.14159265358979323846
8a0efa53
CF
613#define M_PI_2 1.57079632679489661923
614#define M_PI_4 0.78539816339744830962
8a0efa53
CF
615#define M_1_PI 0.31830988618379067154
616#define M_2_PI 0.63661977236758134308
617#define M_2_SQRTPI 1.12837916709551257390
618#define M_SQRT2 1.41421356237309504880
619#define M_SQRT1_2 0.70710678118654752440
a4a96eb4
JT
620
621#endif
622
4e8291b8 623#if __BSD_VISIBLE
a4a96eb4
JT
624
625#define M_TWOPI (M_PI * 2.0)
626#define M_3PI_4 2.3561944901923448370E0
627#define M_SQRTPI 1.77245385090551602792981
8a0efa53
CF
628#define M_LN2LO 1.9082149292705877000E-10
629#define M_LN2HI 6.9314718036912381649E-1
895d76fe 630#define M_SQRT3 1.73205080756887719000
8a0efa53 631#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
fd451503 632#define M_LOG2_E _M_LN2
8a0efa53
CF
633#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
634
4e8291b8 635#endif /* __BSD_VISIBLE */
8a0efa53 636
c1a3171f
JJ
637_END_STD_C
638
8a0efa53
CF
639#ifdef __FAST_MATH__
640#include <machine/fastmath.h>
641#endif
642
8a0efa53 643#endif /* _MATH_H_ */
This page took 0.31912 seconds and 5 git commands to generate.