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.
110 * NOTE: The CRTDLL version uses _HUGE_dll instead.
113 #if __MINGW_GNUC_PREREQ(3, 3)
114 #define HUGE_VAL __builtin_huge_val()
117 #ifndef __DECLSPEC_SUPPORTED
120 extern double* _imp___HUGE;
121 #define HUGE_VAL (*_imp___HUGE)
124 extern double* _imp___HUGE_dll;
125 #define HUGE_VAL (*_imp___HUGE_dll)
128 #else /* __DECLSPEC_SUPPORTED */
131 __MINGW_IMPORT double _HUGE;
132 #define HUGE_VAL _HUGE
135 __MINGW_IMPORT double _HUGE_dll;
136 #define HUGE_VAL _HUGE_dll
139 #endif /* __DECLSPEC_SUPPORTED */
140 #endif /* __MINGW_GNUC_PREREQ(3, 3) */
152 _CRTIMP double __cdecl sin (double);
153 _CRTIMP double __cdecl cos (double);
154 _CRTIMP double __cdecl tan (double);
155 _CRTIMP double __cdecl sinh (double);
156 _CRTIMP double __cdecl cosh (double);
157 _CRTIMP double __cdecl tanh (double);
158 _CRTIMP double __cdecl asin (double);
159 _CRTIMP double __cdecl acos (double);
160 _CRTIMP double __cdecl atan (double);
161 _CRTIMP double __cdecl atan2 (double, double);
162 _CRTIMP double __cdecl exp (double);
163 _CRTIMP double __cdecl log (double);
164 _CRTIMP double __cdecl log10 (double);
165 _CRTIMP double __cdecl pow (double, double);
166 _CRTIMP double __cdecl sqrt (double);
167 _CRTIMP double __cdecl ceil (double);
168 _CRTIMP double __cdecl floor (double);
169 _CRTIMP double __cdecl fabs (double);
170 _CRTIMP double __cdecl ldexp (double, int);
171 _CRTIMP double __cdecl frexp (double, int*);
172 _CRTIMP double __cdecl modf (double, double*);
173 _CRTIMP double __cdecl fmod (double, double);
175 /* Excess precision when using a 64-bit mantissa for FPU math ops can
176 cause unexpected results with some of the MSVCRT math functions. For
177 example, unless the function return value is stored (truncating to
178 53-bit mantissa), calls to pow with both x and y as integral values
179 sometimes produce a non-integral result.
180 One workaround is to reset the FPU env to 53-bit mantissa
181 by a call to fesetenv (FE_PC53_ENV). Amother is to force storage
182 of the return value of individual math functions using wrappers.
183 NB, using these wrappers will disable builtin math functions and
184 hence disable the folding of function results at compile time when
185 arguments are constant. */
188 #define __DEFINE_FLOAT_STORE_MATHFN_D1(fn1) \
189 static __inline__ double \
190 __float_store_ ## fn1 (double x) \
192 __volatile__ double res = (fn1) (x); \
196 #define __DEFINE_FLOAT_STORE_MATHFN_D2(fn2) \
197 static __inline__ double \
198 __float_store_ ## fn2 (double x, double y) \
200 __volatile__ double res = (fn2) (x, y); \
205 /* For example, here is how to force the result of the pow function
209 /* Define the ___float_store_pow function and use it instead of pow(). */
210 __DEFINE_FLOAT_STORE_MATHFN_D2 (pow)
211 #define pow __float_store_pow
214 #ifndef __STRICT_ANSI__
216 /* Complex number (for _cabs). This is the MS version. The ISO
217 C99 counterpart _Complex is an intrinsic type in GCC and
218 'complex' is defined as a macro. See complex.h */
221 double x; /* Real part */
222 double y; /* Imaginary part */
225 _CRTIMP double __cdecl _cabs (struct _complex);
227 _CRTIMP double __cdecl _hypot (double, double);
228 _CRTIMP double __cdecl _j0 (double);
229 _CRTIMP double __cdecl _j1 (double);
230 _CRTIMP double __cdecl _jn (int, double);
231 _CRTIMP double __cdecl _y0 (double);
232 _CRTIMP double __cdecl _y1 (double);
233 _CRTIMP double __cdecl _yn (int, double);
234 _CRTIMP int __cdecl _matherr (struct _exception *);
236 /* These are also declared in Mingw float.h; needed here as well to work
237 around GCC build issues. */
238 /* BEGIN FLOAT.H COPY */
240 * IEEE recommended functions
243 _CRTIMP double __cdecl _chgsign (double);
244 _CRTIMP double __cdecl _copysign (double, double);
245 _CRTIMP double __cdecl _logb (double);
246 _CRTIMP double __cdecl _nextafter (double, double);
247 _CRTIMP double __cdecl _scalb (double, long);
249 _CRTIMP int __cdecl _finite (double);
250 _CRTIMP int __cdecl _fpclass (double);
251 _CRTIMP int __cdecl _isnan (double);
253 /* END FLOAT.H COPY */
257 * Non-underscored versions of non-ANSI functions.
258 * These reside in liboldnames.a.
261 #if !defined (_NO_OLDNAMES)
263 _CRTIMP double __cdecl j0 (double);
264 _CRTIMP double __cdecl j1 (double);
265 _CRTIMP double __cdecl jn (int, double);
266 _CRTIMP double __cdecl y0 (double);
267 _CRTIMP double __cdecl y1 (double);
268 _CRTIMP double __cdecl yn (int, double);
270 _CRTIMP double __cdecl chgsign (double);
272 * scalb() is a GCC built-in.
273 * Exclude this _scalb() stub; the semantics are incompatible
274 * with the built-in implementation.
276 _CRTIMP double __cdecl scalb (double, long);
279 _CRTIMP int __cdecl finite (double);
280 _CRTIMP int __cdecl fpclass (double);
282 #define FP_SNAN _FPCLASS_SNAN
283 #define FP_QNAN _FPCLASS_QNAN
284 #define FP_NINF _FPCLASS_NINF
285 #define FP_PINF _FPCLASS_PINF
286 #define FP_NDENORM _FPCLASS_ND
287 #define FP_PDENORM _FPCLASS_PD
288 #define FP_NZERO _FPCLASS_NZ
289 #define FP_PZERO _FPCLASS_PZ
290 #define FP_NNORM _FPCLASS_NN
291 #define FP_PNORM _FPCLASS_PN
293 #endif /* Not _NO_OLDNAMES */
295 /* This require msvcr70.dll or higher. */
296 #if __MSVCRT_VERSION__ >= 0x0700
297 _CRTIMP int __cdecl _set_SSE2_enable (int);
298 #endif /* __MSVCRT_VERSION__ >= 0x0700 */
301 #endif /* __STRICT_ANSI__ */
305 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
306 || !defined __STRICT_ANSI__ || defined __cplusplus
308 #if __MINGW_GNUC_PREREQ(3, 3)
309 #define HUGE_VALF __builtin_huge_valf()
310 #define HUGE_VALL __builtin_huge_vall()
311 #define INFINITY __builtin_inf()
312 #define NAN __builtin_nan("")
314 extern const float __INFF;
315 #define HUGE_VALF __INFF
316 extern const long double __INFL;
317 #define HUGE_VALL __INFL
318 #define INFINITY HUGE_VALF
319 extern const double __QNAN;
321 #endif /* __MINGW_GNUC_PREREQ(3, 3) */
323 /* Use the compiler's builtin define for FLT_EVAL_METHOD to
324 set float_t and double_t. */
325 #if defined(__FLT_EVAL_METHOD__)
326 # if ( __FLT_EVAL_METHOD__== 0)
327 typedef float float_t;
328 typedef double double_t;
329 # elif (__FLT_EVAL_METHOD__ == 1)
330 typedef double float_t;
331 typedef double double_t;
332 # elif (__FLT_EVAL_METHOD__ == 2)
333 typedef long double float_t;
334 typedef long double double_t;
336 #else /* ix87 FPU default */
337 typedef long double float_t;
338 typedef long double double_t;
343 Return values for fpclassify.
344 These are based on Intel x87 fpu condition codes
345 in the high byte of status word and differ from
346 the return values for MS IEEE 754 extension _fpclass()
348 #define FP_NAN 0x0100
349 #define FP_NORMAL 0x0400
350 #define FP_INFINITE (FP_NAN | FP_NORMAL)
351 #define FP_ZERO 0x4000
352 #define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
353 /* 0x0200 is signbit mask */
357 We can't inline float or double, because we want to ensure truncation
358 to semantic type before classification.
359 (A normal long double value might become subnormal when
360 converted to double, and zero when converted to float.)
363 extern int __cdecl __fpclassifyf (float);
364 extern int __cdecl __fpclassify (double);
365 extern int __cdecl __fpclassifyl (long double);
367 #ifndef __NO_INLINE__
368 __CRT_INLINE int __cdecl __fpclassifyl (long double x){
370 __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
371 return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
375 #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \
376 : sizeof (x) == sizeof (double) ? __fpclassify (x) \
380 #define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
383 #define isinf(x) (fpclassify(x) == FP_INFINITE)
386 /* We don't need to worry about truncation here:
387 A NaN stays a NaN. */
388 extern int __cdecl __isnan (double);
389 extern int __cdecl __isnanf (float);
390 extern int __cdecl __isnanl (long double);
391 #ifndef __NO_INLINE__
392 __CRT_INLINE int __cdecl __isnan (double _x)
396 "fstsw %%ax": "=a" (sw) : "t" (_x));
397 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
401 __CRT_INLINE int __cdecl __isnanf (float _x)
405 "fstsw %%ax": "=a" (sw) : "t" (_x));
406 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
410 __CRT_INLINE int __cdecl __isnanl (long double _x)
414 "fstsw %%ax": "=a" (sw) : "t" (_x));
415 return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
420 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \
421 : sizeof (x) == sizeof (double) ? __isnan (x) \
425 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
427 /* 7.12.3.6 The signbit macro */
428 extern int __cdecl __signbit (double);
429 extern int __cdecl __signbitf (float);
430 extern int __cdecl __signbitl (long double);
431 #ifndef __NO_INLINE__
432 __CRT_INLINE int __cdecl __signbit (double x) {
434 __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
435 return (stw & 0x0200) != 0;
438 __CRT_INLINE int __cdecl __signbitf (float x) {
440 __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
441 return (stw & 0x0200) != 0;
444 __CRT_INLINE int __cdecl __signbitl (long double x) {
446 __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
447 return (stw & 0x0200) != 0;
451 #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \
452 : sizeof (x) == sizeof (double) ? __signbit (x) \
455 /* 7.12.4 Trigonometric functions: Double in C89 */
456 extern float __cdecl sinf (float);
457 extern long double __cdecl sinl (long double);
459 extern float __cdecl cosf (float);
460 extern long double __cdecl cosl (long double);
462 extern float __cdecl tanf (float);
463 extern long double __cdecl tanl (long double);
465 extern float __cdecl asinf (float);
466 extern long double __cdecl asinl (long double);
468 extern float __cdecl acosf (float);
469 extern long double __cdecl acosl (long double);
471 extern float __cdecl atanf (float);
472 extern long double __cdecl atanl (long double);
474 extern float __cdecl atan2f (float, float);
475 extern long double __cdecl atan2l (long double, long double);
477 /* 7.12.5 Hyperbolic functions: Double in C89 */
478 extern float __cdecl sinhf (float);
479 #ifndef __NO_INLINE__
480 __CRT_INLINE float __cdecl sinhf (float x)
481 {return (float) sinh (x);}
483 extern long double __cdecl sinhl (long double);
485 extern float __cdecl coshf (float);
486 #ifndef __NO_INLINE__
487 __CRT_INLINE float __cdecl coshf (float x)
488 {return (float) cosh (x);}
490 extern long double __cdecl coshl (long double);
492 extern float __cdecl tanhf (float);
493 #ifndef __NO_INLINE__
494 __CRT_INLINE float __cdecl tanhf (float x)
495 {return (float) tanh (x);}
497 extern long double __cdecl tanhl (long double);
499 /* Inverse hyperbolic trig functions */
501 extern double __cdecl acosh (double);
502 extern float __cdecl acoshf (float);
503 extern long double __cdecl acoshl (long double);
506 extern double __cdecl asinh (double);
507 extern float __cdecl asinhf (float);
508 extern long double __cdecl asinhl (long double);
511 extern double __cdecl atanh (double);
512 extern float __cdecl atanhf (float);
513 extern long double __cdecl atanhl (long double);
515 /* Exponentials and logarithms */
516 /* 7.12.6.1 Double in C89 */
517 extern float __cdecl expf (float);
518 #ifndef __NO_INLINE__
519 __CRT_INLINE float __cdecl expf (float x)
520 {return (float) exp (x);}
522 extern long double __cdecl expl (long double);
525 extern double __cdecl exp2(double);
526 extern float __cdecl exp2f(float);
527 extern long double __cdecl exp2l(long double);
529 /* 7.12.6.3 The expm1 functions */
530 /* TODO: These could be inlined */
531 extern double __cdecl expm1(double);
532 extern float __cdecl expm1f(float);
533 extern long double __cdecl expm1l(long double);
535 /* 7.12.6.4 Double in C89 */
536 extern float __cdecl frexpf (float, int*);
537 #ifndef __NO_INLINE__
538 __CRT_INLINE float __cdecl frexpf (float x, int* expn)
539 {return (float) frexp (x, expn);}
541 extern long double __cdecl frexpl (long double, int*);
544 #define FP_ILOGB0 ((int)0x80000000)
545 #define FP_ILOGBNAN ((int)0x80000000)
546 extern int __cdecl ilogb (double);
547 extern int __cdecl ilogbf (float);
548 extern int __cdecl ilogbl (long double);
550 /* 7.12.6.6 Double in C89 */
551 extern float __cdecl ldexpf (float, int);
552 #ifndef __NO_INLINE__
553 __CRT_INLINE float __cdecl ldexpf (float x, int expn)
554 {return (float) ldexp (x, expn);}
556 extern long double __cdecl ldexpl (long double, int);
558 /* 7.12.6.7 Double in C89 */
559 extern float __cdecl logf (float);
560 extern long double __cdecl logl (long double);
562 /* 7.12.6.8 Double in C89 */
563 extern float __cdecl log10f (float);
564 extern long double __cdecl log10l (long double);
567 extern double __cdecl log1p(double);
568 extern float __cdecl log1pf(float);
569 extern long double __cdecl log1pl(long double);
572 extern double __cdecl log2 (double);
573 extern float __cdecl log2f (float);
574 extern long double __cdecl log2l (long double);
577 extern double __cdecl logb (double);
578 extern float __cdecl logbf (float);
579 extern long double __cdecl logbl (long double);
581 /* Inline versions. GCC-4.0+ can do a better fast-math optimization
583 #ifndef __NO_INLINE__
584 #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
585 __CRT_INLINE double __cdecl logb (double x)
588 __asm__ ("fxtract\n\t"
589 "fstp %%st" : "=t" (res) : "0" (x));
593 __CRT_INLINE float __cdecl logbf (float x)
596 __asm__ ("fxtract\n\t"
597 "fstp %%st" : "=t" (res) : "0" (x));
601 __CRT_INLINE long double __cdecl logbl (long double x)
604 __asm__ ("fxtract\n\t"
605 "fstp %%st" : "=t" (res) : "0" (x));
608 #endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */
609 #endif /* !defined __NO_INLINE__ */
611 /* 7.12.6.12 Double in C89 */
612 extern float __cdecl modff (float, float*);
613 extern long double __cdecl modfl (long double, long double*);
616 extern double __cdecl scalbn (double, int);
617 extern float __cdecl scalbnf (float, int);
618 extern long double __cdecl scalbnl (long double, int);
620 extern double __cdecl scalbln (double, long);
621 extern float __cdecl scalblnf (float, long);
622 extern long double __cdecl scalblnl (long double, long);
625 /* Implementations adapted from Cephes versions */
626 extern double __cdecl cbrt (double);
627 extern float __cdecl cbrtf (float);
628 extern long double __cdecl cbrtl (long double);
630 /* 7.12.7.2 The fabs functions: Double in C89 */
631 extern float __cdecl fabsf (float x);
632 extern long double __cdecl fabsl (long double x);
635 extern double __cdecl hypot (double, double); /* in libmoldname.a */
636 extern float __cdecl hypotf (float, float);
637 #ifndef __NO_INLINE__
638 __CRT_INLINE float __cdecl hypotf (float x, float y)
639 { return (float) hypot (x, y);}
641 extern long double __cdecl hypotl (long double, long double);
643 /* 7.12.7.4 The pow functions. Double in C89 */
644 extern float __cdecl powf (float, float);
645 #ifndef __NO_INLINE__
646 __CRT_INLINE float __cdecl powf (float x, float y)
647 {return (float) pow (x, y);}
649 extern long double __cdecl powl (long double, long double);
651 /* 7.12.7.5 The sqrt functions. Double in C89. */
652 extern float __cdecl sqrtf (float);
653 extern long double __cdecl sqrtl (long double);
655 /* 7.12.8.1 The erf functions */
656 extern double __cdecl erf (double);
657 extern float __cdecl erff (float);
658 extern long double __cdecl erfl (long double);
660 /* 7.12.8.2 The erfc functions */
661 extern double __cdecl erfc (double);
662 extern float __cdecl erfcf (float);
663 extern long double __cdecl erfcl (long double);
665 /* 7.12.8.3 The lgamma functions */
666 extern double __cdecl lgamma (double);
667 extern float __cdecl lgammaf (float);
668 extern long double __cdecl lgammal (long double);
670 /* 7.12.8.4 The tgamma functions */
671 extern double __cdecl tgamma (double);
672 extern float __cdecl tgammaf (float);
673 extern long double __cdecl tgammal (long double);
675 /* 7.12.9.1 Double in C89 */
676 extern float __cdecl ceilf (float);
677 extern long double __cdecl ceill (long double);
679 /* 7.12.9.2 Double in C89 */
680 extern float __cdecl floorf (float);
681 extern long double __cdecl floorl (long double);
684 extern double __cdecl nearbyint ( double);
685 extern float __cdecl nearbyintf (float);
686 extern long double __cdecl nearbyintl (long double);
689 /* round, using fpu control word settings */
690 extern double __cdecl rint (double);
691 extern float __cdecl rintf (float);
692 extern long double __cdecl rintl (long double);
695 extern long __cdecl lrint (double);
696 extern long __cdecl lrintf (float);
697 extern long __cdecl lrintl (long double);
699 extern long long __cdecl llrint (double);
700 extern long long __cdecl llrintf (float);
701 extern long long __cdecl llrintl (long double);
703 /* Inline versions of above.
704 GCC 4.0+ can do a better fast-math job with __builtins. */
705 #ifndef __NO_INLINE__
706 #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
707 __CRT_INLINE double __cdecl rint (double x)
710 __asm__ ("frndint;": "=t" (retval) : "0" (x));
714 __CRT_INLINE float __cdecl rintf (float x)
717 __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
721 __CRT_INLINE long double __cdecl rintl (long double x)
724 __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
728 __CRT_INLINE long __cdecl lrint (double x)
732 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
736 __CRT_INLINE long __cdecl lrintf (float x)
740 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
744 __CRT_INLINE long __cdecl lrintl (long double x)
748 ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
752 __CRT_INLINE long long __cdecl llrint (double x)
756 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
760 __CRT_INLINE long long __cdecl llrintf (float x)
764 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
768 __CRT_INLINE long long __cdecl llrintl (long double x)
772 ("fistpll %0" : "=m" (retval) : "t" (x) : "st");
775 #endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */
776 #endif /* !defined __NO_INLINE */
779 /* round away from zero, regardless of fpu control word settings */
780 extern double __cdecl round (double);
781 extern float __cdecl roundf (float);
782 extern long double __cdecl roundl (long double);
785 extern long __cdecl lround (double);
786 extern long __cdecl lroundf (float);
787 extern long __cdecl lroundl (long double);
789 extern long long __cdecl llround (double);
790 extern long long __cdecl llroundf (float);
791 extern long long __cdecl llroundl (long double);
794 /* round towards zero, regardless of fpu control word settings */
795 extern double __cdecl trunc (double);
796 extern float __cdecl truncf (float);
797 extern long double __cdecl truncl (long double);
799 /* 7.12.10.1 Double in C89 */
800 extern float __cdecl fmodf (float, float);
801 extern long double __cdecl fmodl (long double, long double);
804 extern double __cdecl remainder (double, double);
805 extern float __cdecl remainderf (float, float);
806 extern long double __cdecl remainderl (long double, long double);
809 extern double __cdecl remquo(double, double, int *);
810 extern float __cdecl remquof(float, float, int *);
811 extern long double __cdecl remquol(long double, long double, int *);
814 extern double __cdecl copysign (double, double); /* in libmoldname.a */
815 extern float __cdecl copysignf (float, float);
816 extern long double __cdecl copysignl (long double, long double);
818 /* 7.12.11.2 Return a NaN */
819 extern double __cdecl nan(const char *tagp);
820 extern float __cdecl nanf(const char *tagp);
821 extern long double __cdecl nanl(const char *tagp);
823 #ifndef __STRICT_ANSI__
824 #define _nan() nan("")
825 #define _nanf() nanf("")
826 #define _nanl() nanl("")
830 extern double __cdecl nextafter (double, double); /* in libmoldname.a */
831 extern float __cdecl nextafterf (float, float);
832 extern long double __cdecl nextafterl (long double, long double);
834 /* 7.12.11.4 The nexttoward functions */
835 extern double __cdecl nexttoward (double, long double);
836 extern float __cdecl nexttowardf (float, long double);
837 extern long double __cdecl nexttowardl (long double, long double);
840 /* x > y ? (x - y) : 0.0 */
841 extern double __cdecl fdim (double x, double y);
842 extern float __cdecl fdimf (float x, float y);
843 extern long double __cdecl fdiml (long double x, long double y);
846 NaN arguments are treated as missing data: if one argument is a NaN
847 and the other numeric, then these functions choose the numeric
851 extern double __cdecl fmax (double, double);
852 extern float __cdecl fmaxf (float, float);
853 extern long double __cdecl fmaxl (long double, long double);
856 extern double __cdecl fmin (double, double);
857 extern float __cdecl fminf (float, float);
858 extern long double __cdecl fminl (long double, long double);
861 /* return x * y + z as a ternary op */
862 extern double __cdecl fma (double, double, double);
863 extern float __cdecl fmaf (float, float, float);
864 extern long double __cdecl fmal (long double, long double, long double);
869 * With these functions, comparisons involving quiet NaNs set the FP
870 * condition code to "unordered". The IEEE floating-point spec
871 * dictates that the result of floating-point comparisons should be
872 * false whenever a NaN is involved, with the exception of the != op,
873 * which always returns true: yes, (NaN != NaN) is true).
876 #define isgreater(x, y) __builtin_isgreater(x, y)
877 #define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
878 #define isless(x, y) __builtin_isless(x, y)
879 #define islessequal(x, y) __builtin_islessequal(x, y)
880 #define islessgreater(x, y) __builtin_islessgreater(x, y)
881 #define isunordered(x, y) __builtin_isunordered(x, y)
883 #endif /* __STDC_VERSION__ >= 199901L */
884 #endif /* __NO_ISOCEXT */
889 #endif /* Not RC_INVOKED */
892 #endif /* Not _MATH_H_ */