3 * @copy 2012 MinGW.org project
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
26 #pragma GCC system_header
28 /* All the headers include this file. */
32 * Types for the _exception structure.
35 #define _DOMAIN 1 /* domain error in argument */
36 #define _SING 2 /* singularity */
37 #define _OVERFLOW 3 /* range overflow */
38 #define _UNDERFLOW 4 /* range underflow */
39 #define _TLOSS 5 /* total loss of precision */
40 #define _PLOSS 6 /* partial loss of precision */
43 * Exception types with non-ANSI names for compatibility.
46 #ifndef __STRICT_ANSI__
49 #define DOMAIN _DOMAIN
51 #define OVERFLOW _OVERFLOW
52 #define UNDERFLOW _UNDERFLOW
56 #endif /* Not _NO_OLDNAMES */
57 #endif /* Not __STRICT_ANSI__ */
60 /* Traditional/XOPEN math constants (double precison) */
61 #ifndef __STRICT_ANSI__
62 #define M_E 2.7182818284590452354
63 #define M_LOG2E 1.4426950408889634074
64 #define M_LOG10E 0.43429448190325182765
65 #define M_LN2 0.69314718055994530942
66 #define M_LN10 2.30258509299404568402
67 #define M_PI 3.14159265358979323846
68 #define M_PI_2 1.57079632679489661923
69 #define M_PI_4 0.78539816339744830962
70 #define M_1_PI 0.31830988618379067154
71 #define M_2_PI 0.63661977236758134308
72 #define M_2_SQRTPI 1.12837916709551257390
73 #define M_SQRT2 1.41421356237309504880
74 #define M_SQRT1_2 0.70710678118654752440
77 /* These are also defined in Mingw float.h; needed here as well to work
78 around GCC build issues. */
79 #ifndef __STRICT_ANSI__
80 #ifndef __MINGW_FPCLASS_DEFINED
81 #define __MINGW_FPCLASS_DEFINED 1
82 /* IEEE 754 classication */
83 #define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
84 #define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
85 #define _FPCLASS_NINF 0x0004 /* Negative Infinity */
86 #define _FPCLASS_NN 0x0008 /* Negative Normal */
87 #define _FPCLASS_ND 0x0010 /* Negative Denormal */
88 #define _FPCLASS_NZ 0x0020 /* Negative Zero */
89 #define _FPCLASS_PZ 0x0040 /* Positive Zero */
90 #define _FPCLASS_PD 0x0080 /* Positive Denormal */
91 #define _FPCLASS_PN 0x0100 /* Positive Normal */
92 #define _FPCLASS_PINF 0x0200 /* Positive Infinity */
93 #endif /* __MINGW_FPCLASS_DEFINED */
94 #endif /* Not __STRICT_ANSI__ */
103 * HUGE_VAL is returned by strtod when the value would overflow the
104 * representation of 'double'. There are other uses as well.
106 * __imp__HUGE is a pointer to the actual variable _HUGE in
107 * MSVCRT.DLL. If we used _HUGE directly we would get a pointer
108 * to a thunk function.
111 #define HUGE_VAL __builtin_huge_val()
122 _CRTIMP double __cdecl sin (double);
123 _CRTIMP double __cdecl cos (double);
124 _CRTIMP double __cdecl tan (double);
125 _CRTIMP double __cdecl sinh (double);
126 _CRTIMP double __cdecl cosh (double);
127 _CRTIMP double __cdecl tanh (double);
128 _CRTIMP double __cdecl asin (double);
129 _CRTIMP double __cdecl acos (double);
130 _CRTIMP double __cdecl atan (double);
131 _CRTIMP double __cdecl atan2 (double, double);
132 _CRTIMP double __cdecl exp (double);
133 _CRTIMP double __cdecl log (double);
134 _CRTIMP double __cdecl log10 (double);
135 _CRTIMP double __cdecl pow (double, double);
136 _CRTIMP double __cdecl sqrt (double);
137 _CRTIMP double __cdecl ceil (double);
138 _CRTIMP double __cdecl floor (double);
139 _CRTIMP double __cdecl fabs (double);
140 _CRTIMP double __cdecl ldexp (double, int);
141 _CRTIMP double __cdecl frexp (double, int*);
142 _CRTIMP double __cdecl modf (double, double*);
143 _CRTIMP double __cdecl fmod (double, double);
145 /* Excess precision when using a 64-bit mantissa for FPU math ops can
146 cause unexpected results with some of the MSVCRT math functions. For
147 example, unless the function return value is stored (truncating to
148 53-bit mantissa), calls to pow with both x and y as integral values
149 sometimes produce a non-integral result.
150 One workaround is to reset the FPU env to 53-bit mantissa
151 by a call to fesetenv (FE_PC53_ENV). Amother is to force storage
152 of the return value of individual math functions using wrappers.
153 NB, using these wrappers will disable builtin math functions and
154 hence disable the folding of function results at compile time when
155 arguments are constant. */
158 #define __DEFINE_FLOAT_STORE_MATHFN_D1(fn1) \
159 static __inline__ double \
160 __float_store_ ## fn1 (double x) \
162 __volatile__ double res = (fn1) (x); \
166 #define __DEFINE_FLOAT_STORE_MATHFN_D2(fn2) \
167 static __inline__ double \
168 __float_store_ ## fn2 (double x, double y) \
170 __volatile__ double res = (fn2) (x, y); \
175 /* For example, here is how to force the result of the pow function
179 /* Define the ___float_store_pow function and use it instead of pow(). */
180 __DEFINE_FLOAT_STORE_MATHFN_D2 (pow)
181 #define pow __float_store_pow
184 #ifndef __STRICT_ANSI__
186 /* Complex number (for _cabs). This is the MS version. The ISO
187 C99 counterpart _Complex is an intrinsic type in GCC and
188 'complex' is defined as a macro. See complex.h */
191 double x; /* Real part */
192 double y; /* Imaginary part */
195 _CRTIMP double __cdecl _cabs (struct _complex);
197 _CRTIMP double __cdecl _hypot (double, double);
198 _CRTIMP double __cdecl _j0 (double);
199 _CRTIMP double __cdecl _j1 (double);
200 _CRTIMP double __cdecl _jn (int, double);
201 _CRTIMP double __cdecl _y0 (double);
202 _CRTIMP double __cdecl _y1 (double);
203 _CRTIMP double __cdecl _yn (int, double);
204 _CRTIMP int __cdecl _matherr (struct _exception *);
206 /* These are also declared in Mingw float.h; needed here as well to work
207 around GCC build issues. */
208 /* BEGIN FLOAT.H COPY */
210 * IEEE recommended functions
213 _CRTIMP double __cdecl _chgsign (double);
214 _CRTIMP double __cdecl _copysign (double, double);
215 _CRTIMP double __cdecl _logb (double);
216 _CRTIMP double __cdecl _nextafter (double, double);
217 _CRTIMP double __cdecl _scalb (double, long);
219 _CRTIMP int __cdecl _finite (double);
220 _CRTIMP int __cdecl _fpclass (double);
221 _CRTIMP int __cdecl _isnan (double);
223 /* END FLOAT.H COPY */
227 * Non-underscored versions of non-ANSI functions.
228 * These reside in liboldnames.a.
231 #if !defined (_NO_OLDNAMES)
233 _CRTIMP double __cdecl j0 (double);
234 _CRTIMP double __cdecl j1 (double);
235 _CRTIMP double __cdecl jn (int, double);
236 _CRTIMP double __cdecl y0 (double);
237 _CRTIMP double __cdecl y1 (double);
238 _CRTIMP double __cdecl yn (int, double);
240 _CRTIMP double __cdecl chgsign (double);
242 * scalb() is a GCC built-in.
243 * Exclude this _scalb() stub; the semantics are incompatible
244 * with the built-in implementation.
246 _CRTIMP double __cdecl scalb (double, long);
249 _CRTIMP int __cdecl finite (double);
250 _CRTIMP int __cdecl fpclass (double);
252 #define FP_SNAN _FPCLASS_SNAN
253 #define FP_QNAN _FPCLASS_QNAN
254 #define FP_NINF _FPCLASS_NINF
255 #define FP_PINF _FPCLASS_PINF
256 #define FP_NDENORM _FPCLASS_ND
257 #define FP_PDENORM _FPCLASS_PD
258 #define FP_NZERO _FPCLASS_NZ
259 #define FP_PZERO _FPCLASS_PZ
260 #define FP_NNORM _FPCLASS_NN
261 #define FP_PNORM _FPCLASS_PN
263 #endif /* Not _NO_OLDNAMES */
265 /* This require msvcr70.dll or higher. */
266 #if __MSVCRT_VERSION__ >= 0x0700
267 _CRTIMP int __cdecl _set_SSE2_enable (int);
268 #endif /* __MSVCRT_VERSION__ >= 0x0700 */
271 #endif /* __STRICT_ANSI__ */
275 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
276 || !defined __STRICT_ANSI__ || defined __cplusplus
278 #if __MINGW_GNUC_PREREQ(3, 3)
279 #define HUGE_VALF __builtin_huge_valf()
280 #define HUGE_VALL __builtin_huge_vall()
281 #define INFINITY __builtin_inf()
282 #define NAN __builtin_nan("")
284 extern const float __INFF;
285 #define HUGE_VALF __INFF
286 extern const long double __INFL;
287 #define HUGE_VALL __INFL
288 #define INFINITY HUGE_VALF
289 extern const double __QNAN;
291 #endif /* __MINGW_GNUC_PREREQ(3, 3) */
293 /* Use the compiler's builtin define for FLT_EVAL_METHOD to
294 set float_t and double_t. */
295 #if defined(__FLT_EVAL_METHOD__)
296 # if ( __FLT_EVAL_METHOD__== 0)
297 typedef float float_t;
298 typedef double double_t;
299 # elif (__FLT_EVAL_METHOD__ == 1)
300 typedef double float_t;
301 typedef double double_t;
302 # elif (__FLT_EVAL_METHOD__ == 2)
303 typedef long double float_t;
304 typedef long double double_t;
306 #else /* ix87 FPU default */
307 typedef long double float_t;
308 typedef long double double_t;
313 Return values for fpclassify.
314 These are based on Intel x87 fpu condition codes
315 in the high byte of status word and differ from
316 the return values for MS IEEE 754 extension _fpclass()
318 #define FP_NAN 0x0100
319 #define FP_NORMAL 0x0400
320 #define FP_INFINITE (FP_NAN | FP_NORMAL)
321 #define FP_ZERO 0x4000
322 #define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
323 /* 0x0200 is signbit mask */
327 We can't inline float or double, because we want to ensure truncation
328 to semantic type before classification.
329 (A normal long double value might become subnormal when
330 converted to double, and zero when converted to float.)
333 extern int __cdecl __fpclassifyf (float);
334 extern int __cdecl __fpclassify (double);
335 extern int __cdecl __fpclassifyl (long double);
337 #ifndef __NO_INLINE__
338 __CRT_INLINE int __cdecl __fpclassifyl (long double x){
340 __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
341 return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
345 #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \
346 : sizeof (x) == sizeof (double) ? __fpclassify (x) \
350 #define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
353 #define isinf(x) (fpclassify(x) == FP_INFINITE)
356 /* We don't need to worry about truncation here:
357 A NaN stays a NaN. */
358 extern int __cdecl __isnan (double);
359 extern int __cdecl __isnanf (float);
360 extern int __cdecl __isnanl (long double);
361 #ifndef __NO_INLINE__
362 __CRT_INLINE int __cdecl __isnan (double _x)
366 "fstsw %%ax": "=a" (sw) : "t" (_x));
367 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
371 __CRT_INLINE int __cdecl __isnanf (float _x)
375 "fstsw %%ax": "=a" (sw) : "t" (_x));
376 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
380 __CRT_INLINE int __cdecl __isnanl (long double _x)
384 "fstsw %%ax": "=a" (sw) : "t" (_x));
385 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
390 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \
391 : sizeof (x) == sizeof (double) ? __isnan (x) \
395 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
397 /* 7.12.3.6 The signbit macro */
398 extern int __cdecl __signbit (double);
399 extern int __cdecl __signbitf (float);
400 extern int __cdecl __signbitl (long double);
401 #ifndef __NO_INLINE__
402 __CRT_INLINE int __cdecl __signbit (double x) {
404 __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
405 return (stw & 0x0200) != 0;
408 __CRT_INLINE int __cdecl __signbitf (float x) {
410 __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
411 return (stw & 0x0200) != 0;
414 __CRT_INLINE int __cdecl __signbitl (long double x) {
416 __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
417 return (stw & 0x0200) != 0;
421 #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \
422 : sizeof (x) == sizeof (double) ? __signbit (x) \
425 /* 7.12.4 Trigonometric functions: Double in C89 */
426 extern float __cdecl sinf (float);
427 extern long double __cdecl sinl (long double);
429 extern float __cdecl cosf (float);
430 extern long double __cdecl cosl (long double);
432 extern float __cdecl tanf (float);
433 extern long double __cdecl tanl (long double);
435 extern float __cdecl asinf (float);
436 extern long double __cdecl asinl (long double);
438 extern float __cdecl acosf (float);
439 extern long double __cdecl acosl (long double);
441 extern float __cdecl atanf (float);
442 extern long double __cdecl atanl (long double);
444 extern float __cdecl atan2f (float, float);
445 extern long double __cdecl atan2l (long double, long double);
447 /* 7.12.5 Hyperbolic functions: Double in C89 */
448 extern float __cdecl sinhf (float);
449 #ifndef __NO_INLINE__
450 __CRT_INLINE float __cdecl sinhf (float x)
451 {return (float) sinh (x);}
453 extern long double __cdecl sinhl (long double);
455 extern float __cdecl coshf (float);
456 #ifndef __NO_INLINE__
457 __CRT_INLINE float __cdecl coshf (float x)
458 {return (float) cosh (x);}
460 extern long double __cdecl coshl (long double);
462 extern float __cdecl tanhf (float);
463 #ifndef __NO_INLINE__
464 __CRT_INLINE float __cdecl tanhf (float x)
465 {return (float) tanh (x);}
467 extern long double __cdecl tanhl (long double);
469 /* Inverse hyperbolic trig functions */
471 extern double __cdecl acosh (double);
472 extern float __cdecl acoshf (float);
473 extern long double __cdecl acoshl (long double);
476 extern double __cdecl asinh (double);
477 extern float __cdecl asinhf (float);
478 extern long double __cdecl asinhl (long double);
481 extern double __cdecl atanh (double);
482 extern float __cdecl atanhf (float);
483 extern long double __cdecl atanhl (long double);
485 /* Exponentials and logarithms */
486 /* 7.12.6.1 Double in C89 */
487 extern float __cdecl expf (float);
488 #ifndef __NO_INLINE__
489 __CRT_INLINE float __cdecl expf (float x)
490 {return (float) exp (x);}
492 extern long double __cdecl expl (long double);
495 extern double __cdecl exp2(double);
496 extern float __cdecl exp2f(float);
497 extern long double __cdecl exp2l(long double);
499 /* 7.12.6.3 The expm1 functions */
500 /* TODO: These could be inlined */
501 extern double __cdecl expm1(double);
502 extern float __cdecl expm1f(float);
503 extern long double __cdecl expm1l(long double);
505 /* 7.12.6.4 Double in C89 */
506 extern float __cdecl frexpf (float, int*);
507 #ifndef __NO_INLINE__
508 __CRT_INLINE float __cdecl frexpf (float x, int* expn)
509 {return (float) frexp (x, expn);}
511 extern long double __cdecl frexpl (long double, int*);
514 #define FP_ILOGB0 ((int)0x80000000)
515 #define FP_ILOGBNAN ((int)0x80000000)
516 extern int __cdecl ilogb (double);
517 extern int __cdecl ilogbf (float);
518 extern int __cdecl ilogbl (long double);
520 /* 7.12.6.6 Double in C89 */
521 extern float __cdecl ldexpf (float, int);
522 #ifndef __NO_INLINE__
523 __CRT_INLINE float __cdecl ldexpf (float x, int expn)
524 {return (float) ldexp (x, expn);}
526 extern long double __cdecl ldexpl (long double, int);
528 /* 7.12.6.7 Double in C89 */
529 extern float __cdecl logf (float);
530 extern long double __cdecl logl (long double);
532 /* 7.12.6.8 Double in C89 */
533 extern float __cdecl log10f (float);
534 extern long double __cdecl log10l (long double);
537 extern double __cdecl log1p(double);
538 extern float __cdecl log1pf(float);
539 extern long double __cdecl log1pl(long double);
542 extern double __cdecl log2 (double);
543 extern float __cdecl log2f (float);
544 extern long double __cdecl log2l (long double);
547 extern double __cdecl logb (double);
548 extern float __cdecl logbf (float);
549 extern long double __cdecl logbl (long double);
551 /* Inline versions. GCC-4.0+ can do a better fast-math optimization
553 #ifndef __NO_INLINE__
554 #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
555 __CRT_INLINE double __cdecl logb (double x)
558 __asm__ ("fxtract\n\t"
559 "fstp %%st" : "=t" (res) : "0" (x));
563 __CRT_INLINE float __cdecl logbf (float x)
566 __asm__ ("fxtract\n\t"
567 "fstp %%st" : "=t" (res) : "0" (x));
571 __CRT_INLINE long double __cdecl logbl (long double x)
574 __asm__ ("fxtract\n\t"
575 "fstp %%st" : "=t" (res) : "0" (x));
578 #endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */
579 #endif /* !defined __NO_INLINE__ */
581 /* 7.12.6.12 Double in C89 */
582 extern float __cdecl modff (float, float*);
583 extern long double __cdecl modfl (long double, long double*);
586 extern double __cdecl scalbn (double, int);
587 extern float __cdecl scalbnf (float, int);
588 extern long double __cdecl scalbnl (long double, int);
590 extern double __cdecl scalbln (double, long);
591 extern float __cdecl scalblnf (float, long);
592 extern long double __cdecl scalblnl (long double, long);
595 /* Implementations adapted from Cephes versions */
596 extern double __cdecl cbrt (double);
597 extern float __cdecl cbrtf (float);
598 extern long double __cdecl cbrtl (long double);
600 /* 7.12.7.2 The fabs functions: Double in C89 */
601 extern float __cdecl fabsf (float x);
602 extern long double __cdecl fabsl (long double x);
605 extern double __cdecl hypot (double, double); /* in libmoldname.a */
606 extern float __cdecl hypotf (float, float);
607 #ifndef __NO_INLINE__
608 __CRT_INLINE float __cdecl hypotf (float x, float y)
609 { return (float) hypot (x, y);}
611 extern long double __cdecl hypotl (long double, long double);
613 /* 7.12.7.4 The pow functions. Double in C89 */
614 extern float __cdecl powf (float, float);
615 #ifndef __NO_INLINE__
616 __CRT_INLINE float __cdecl powf (float x, float y)
617 {return (float) pow (x, y);}
619 extern long double __cdecl powl (long double, long double);
621 /* 7.12.7.5 The sqrt functions. Double in C89. */
622 extern float __cdecl sqrtf (float);
623 extern long double __cdecl sqrtl (long double);
625 /* 7.12.8.1 The erf functions */
626 extern double __cdecl erf (double);
627 extern float __cdecl erff (float);
628 extern long double __cdecl erfl (long double);
630 /* 7.12.8.2 The erfc functions */
631 extern double __cdecl erfc (double);
632 extern float __cdecl erfcf (float);
633 extern long double __cdecl erfcl (long double);
635 /* 7.12.8.3 The lgamma functions */
636 extern double __cdecl lgamma (double);
637 extern float __cdecl lgammaf (float);
638 extern long double __cdecl lgammal (long double);
640 /* 7.12.8.4 The tgamma functions */
641 extern double __cdecl tgamma (double);
642 extern float __cdecl tgammaf (float);
643 extern long double __cdecl tgammal (long double);
645 /* 7.12.9.1 Double in C89 */
646 extern float __cdecl ceilf (float);
647 extern long double __cdecl ceill (long double);
649 /* 7.12.9.2 Double in C89 */
650 extern float __cdecl floorf (float);
651 extern long double __cdecl floorl (long double);
654 extern double __cdecl nearbyint ( double);
655 extern float __cdecl nearbyintf (float);
656 extern long double __cdecl nearbyintl (long double);
659 /* round, using fpu control word settings */
660 extern double __cdecl rint (double);
661 extern float __cdecl rintf (float);
662 extern long double __cdecl rintl (long double);
665 extern long __cdecl lrint (double);
666 extern long __cdecl lrintf (float);
667 extern long __cdecl lrintl (long double);
669 extern long long __cdecl llrint (double);
670 extern long long __cdecl llrintf (float);
671 extern long long __cdecl llrintl (long double);
673 /* Inline versions of above.
674 GCC 4.0+ can do a better fast-math job with __builtins. */
675 #ifndef __NO_INLINE__
676 #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
677 __CRT_INLINE double __cdecl rint (double x)
680 __asm__ ("frndint;": "=t" (retval) : "0" (x));
684 __CRT_INLINE float __cdecl rintf (float x)
687 __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
691 __CRT_INLINE long double __cdecl rintl (long double x)
694 __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
698 __CRT_INLINE long __cdecl lrint (double x)
702 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
706 __CRT_INLINE long __cdecl lrintf (float x)
710 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
714 __CRT_INLINE long __cdecl lrintl (long double x)
718 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
722 __CRT_INLINE long long __cdecl llrint (double x)
726 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
730 __CRT_INLINE long long __cdecl llrintf (float x)
734 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
738 __CRT_INLINE long long __cdecl llrintl (long double x)
742 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
745 #endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */
746 #endif /* !defined __NO_INLINE */
749 /* round away from zero, regardless of fpu control word settings */
750 extern double __cdecl round (double);
751 extern float __cdecl roundf (float);
752 extern long double __cdecl roundl (long double);
755 extern long __cdecl lround (double);
756 extern long __cdecl lroundf (float);
757 extern long __cdecl lroundl (long double);
759 extern long long __cdecl llround (double);
760 extern long long __cdecl llroundf (float);
761 extern long long __cdecl llroundl (long double);
764 /* round towards zero, regardless of fpu control word settings */
765 extern double __cdecl trunc (double);
766 extern float __cdecl truncf (float);
767 extern long double __cdecl truncl (long double);
769 /* 7.12.10.1 Double in C89 */
770 extern float __cdecl fmodf (float, float);
771 extern long double __cdecl fmodl (long double, long double);
774 extern double __cdecl remainder (double, double);
775 extern float __cdecl remainderf (float, float);
776 extern long double __cdecl remainderl (long double, long double);
779 extern double __cdecl remquo(double, double, int *);
780 extern float __cdecl remquof(float, float, int *);
781 extern long double __cdecl remquol(long double, long double, int *);
784 extern double __cdecl copysign (double, double); /* in libmoldname.a */
785 extern float __cdecl copysignf (float, float);
786 extern long double __cdecl copysignl (long double, long double);
788 /* 7.12.11.2 Return a NaN */
789 extern double __cdecl nan(const char *tagp);
790 extern float __cdecl nanf(const char *tagp);
791 extern long double __cdecl nanl(const char *tagp);
793 #ifndef __STRICT_ANSI__
794 #define _nan() nan("")
795 #define _nanf() nanf("")
796 #define _nanl() nanl("")
800 extern double __cdecl nextafter (double, double); /* in libmoldname.a */
801 extern float __cdecl nextafterf (float, float);
802 extern long double __cdecl nextafterl (long double, long double);
804 /* 7.12.11.4 The nexttoward functions */
805 extern double __cdecl nexttoward (double, long double);
806 extern float __cdecl nexttowardf (float, long double);
807 extern long double __cdecl nexttowardl (long double, long double);
810 /* x > y ? (x - y) : 0.0 */
811 extern double __cdecl fdim (double x, double y);
812 extern float __cdecl fdimf (float x, float y);
813 extern long double __cdecl fdiml (long double x, long double y);
816 NaN arguments are treated as missing data: if one argument is a NaN
817 and the other numeric, then these functions choose the numeric
821 extern double __cdecl fmax (double, double);
822 extern float __cdecl fmaxf (float, float);
823 extern long double __cdecl fmaxl (long double, long double);
826 extern double __cdecl fmin (double, double);
827 extern float __cdecl fminf (float, float);
828 extern long double __cdecl fminl (long double, long double);
831 /* return x * y + z as a ternary op */
832 extern double __cdecl fma (double, double, double);
833 extern float __cdecl fmaf (float, float, float);
834 extern long double __cdecl fmal (long double, long double, long double);
839 * With these functions, comparisons involving quiet NaNs set the FP
840 * condition code to "unordered". The IEEE floating-point spec
841 * dictates that the result of floating-point comparisons should be
842 * false whenever a NaN is involved, with the exception of the != op,
843 * which always returns true: yes, (NaN != NaN) is true).
846 #define isgreater(x, y) __builtin_isgreater(x, y)
847 #define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
848 #define isless(x, y) __builtin_isless(x, y)
849 #define islessequal(x, y) __builtin_islessequal(x, y)
850 #define islessgreater(x, y) __builtin_islessgreater(x, y)
851 #define isunordered(x, y) __builtin_isunordered(x, y)
853 #endif /* __STDC_VERSION__ >= 199901L */
854 #endif /* __NO_ISOCEXT */
859 #endif /* Not RC_INVOKED */
862 #endif /* Not _MATH_H_ */