Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _MATH_H_
      7 #define _MATH_H_
      8 
      9 #ifdef __GNUC__
     10 #pragma GCC system_header
     11 #endif /* __GNUC__ */
     12 
     13 #include <crtdefs.h>
     14 
     15 struct _exception;
     16 
     17 #pragma pack(push,_CRT_PACKING)
     18 
     19 #define	_DOMAIN		1	/* domain error in argument */
     20 #define	_SING		2	/* singularity */
     21 #define	_OVERFLOW	3	/* range overflow */
     22 #define	_UNDERFLOW	4	/* range underflow */
     23 #define	_TLOSS		5	/* total loss of precision */
     24 #define	_PLOSS		6	/* partial loss of precision */
     25 
     26 #ifndef __STRICT_ANSI__
     27 #ifndef	NO_OLDNAMES
     28 
     29 #define	DOMAIN		_DOMAIN
     30 #define	SING		_SING
     31 #define	OVERFLOW	_OVERFLOW
     32 #define	UNDERFLOW	_UNDERFLOW
     33 #define	TLOSS		_TLOSS
     34 #define	PLOSS		_PLOSS
     35 
     36 #endif
     37 #endif
     38 
     39 #if !defined(__STRICT_ANSI__) || defined(_POSIX_C_SOURCE) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_USE_MATH_DEFINES)
     40 #define M_E		2.7182818284590452354
     41 #define M_LOG2E		1.4426950408889634074
     42 #define M_LOG10E	0.43429448190325182765
     43 #define M_LN2		0.69314718055994530942
     44 #define M_LN10		2.30258509299404568402
     45 #define M_PI		3.14159265358979323846
     46 #define M_PI_2		1.57079632679489661923
     47 #define M_PI_4		0.78539816339744830962
     48 #define M_1_PI		0.31830988618379067154
     49 #define M_2_PI		0.63661977236758134308
     50 #define M_2_SQRTPI	1.12837916709551257390
     51 #define M_SQRT2		1.41421356237309504880
     52 #define M_SQRT1_2	0.70710678118654752440
     53 #endif
     54 
     55 #ifndef __STRICT_ANSI__
     56 /* See also float.h  */
     57 #ifndef __MINGW_FPCLASS_DEFINED
     58 #define __MINGW_FPCLASS_DEFINED 1
     59 /* IEEE 754 classication */
     60 #define	_FPCLASS_SNAN	0x0001	/* Signaling "Not a Number" */
     61 #define	_FPCLASS_QNAN	0x0002	/* Quiet "Not a Number" */
     62 #define	_FPCLASS_NINF	0x0004	/* Negative Infinity */
     63 #define	_FPCLASS_NN	0x0008	/* Negative Normal */
     64 #define	_FPCLASS_ND	0x0010	/* Negative Denormal */
     65 #define	_FPCLASS_NZ	0x0020	/* Negative Zero */
     66 #define	_FPCLASS_PZ	0x0040	/* Positive Zero */
     67 #define	_FPCLASS_PD	0x0080	/* Positive Denormal */
     68 #define	_FPCLASS_PN	0x0100	/* Positive Normal */
     69 #define	_FPCLASS_PINF	0x0200	/* Positive Infinity */
     70 #endif
     71 #endif
     72 
     73 #ifndef RC_INVOKED
     74 
     75 #ifndef __mingw_types_compatible_p
     76 #ifdef __cplusplus
     77 extern "C++" {
     78 template <typename type1, typename type2> struct __mingw_types_compatible_p {
     79   static const bool result = false;
     80 };
     81 
     82 template <typename type1> struct __mingw_types_compatible_p<type1, type1> {
     83  static const bool result = true;
     84 };
     85 
     86 template <typename type1> struct __mingw_types_compatible_p<const type1, type1> {
     87   static const bool result = true;
     88 };
     89 
     90 template <typename type1> struct __mingw_types_compatible_p<type1, const type1> {
     91   static const bool result = true;
     92 };
     93 }
     94 
     95 #define __mingw_types_compatible_p(type1, type2) __mingw_types_compatible_p <type1, type2>::result
     96 #else
     97 #define __mingw_types_compatible_p(type1, type2) __builtin_types_compatible_p (type1, type2)
     98 #endif
     99 #endif
    100 
    101 #ifndef __mingw_choose_expr
    102 #ifdef __cplusplus
    103 #define __mingw_choose_expr(C, E1, E2) ((C) ? E1 : E2)
    104 #else
    105 #define __mingw_choose_expr __builtin_choose_expr
    106 #endif
    107 #endif
    108 
    109 
    110 #ifdef __cplusplus
    111 extern "C" {
    112 #endif
    113 
    114 #ifndef __MINGW_SOFTMATH
    115 #define __MINGW_SOFTMATH
    116 
    117 /* IEEE float/double type shapes.  */
    118 
    119   typedef union __mingw_dbl_type_t {
    120     double x;
    121     unsigned long long val;
    122     __C89_NAMELESS struct {
    123       unsigned int low, high;
    124     } lh;
    125   } __mingw_dbl_type_t;
    126 
    127   typedef union __mingw_flt_type_t {
    128     float x;
    129     unsigned int val;
    130   } __mingw_flt_type_t;
    131 
    132   typedef union __mingw_ldbl_type_t
    133   {
    134     long double x;
    135     __C89_NAMELESS struct {
    136       unsigned int low, high;
    137       int sign_exponent : 16;
    138       int res1 : 16;
    139       int res0 : 32;
    140     } lh;
    141   } __mingw_ldbl_type_t;
    142 
    143   typedef union __mingw_fp_types_t
    144   {
    145     long double *ld;
    146     double *d;
    147     float *f;
    148     __mingw_ldbl_type_t *ldt;
    149     __mingw_dbl_type_t *dt;
    150     __mingw_flt_type_t *ft;
    151   } __mingw_fp_types_t;
    152 
    153 #endif
    154 
    155 #ifndef _HUGE
    156   extern double * __MINGW_IMP_SYMBOL(_HUGE);
    157 #define _HUGE	(* __MINGW_IMP_SYMBOL(_HUGE))
    158 #endif
    159 
    160 #ifdef __GNUC__
    161 #define	HUGE_VAL __builtin_huge_val()
    162 #else
    163 #define HUGE_VAL _HUGE
    164 #endif /* __GNUC__ */
    165 
    166 #ifndef _EXCEPTION_DEFINED
    167 #define _EXCEPTION_DEFINED
    168   struct _exception {
    169     int type;
    170     const char *name;
    171     double arg1;
    172     double arg2;
    173     double retval;
    174   };
    175 
    176   void __mingw_raise_matherr (int typ, const char *name, double a1, double a2,
    177 			      double rslt);
    178   void __mingw_setusermatherr (int (__cdecl *)(struct _exception *));
    179   _CRTIMP void __setusermatherr(int (__cdecl *)(struct _exception *));
    180   #define __setusermatherr __mingw_setusermatherr
    181 #endif
    182 
    183   double __cdecl sin(double _X);
    184   double __cdecl cos(double _X);
    185   double __cdecl tan(double _X);
    186   double __cdecl sinh(double _X);
    187   double __cdecl cosh(double _X);
    188   double __cdecl tanh(double _X);
    189   double __cdecl asin(double _X);
    190   double __cdecl acos(double _X);
    191   double __cdecl atan(double _X);
    192   double __cdecl atan2(double _Y,double _X);
    193   double __cdecl exp(double _X);
    194   double __cdecl log(double _X);
    195   double __cdecl log10(double _X);
    196   double __cdecl pow(double _X,double _Y);
    197   double __cdecl sqrt(double _X);
    198   double __cdecl ceil(double _X);
    199   double __cdecl floor(double _X);
    200 
    201 /* 7.12.7.2 The fabs functions: Double in C89 */
    202   extern  float __cdecl fabsf (float x);
    203   extern long double __cdecl fabsl (long double);
    204   extern double __cdecl fabs (double _X);
    205 
    206 #ifndef __CRT__NO_INLINE
    207 #if !defined (__ia64__)
    208   __CRT_INLINE float __cdecl fabsf (float x)
    209   {
    210 #if defined(__x86_64__) || defined(__arm__)
    211     return __builtin_fabsf (x);
    212 #else
    213     float res = 0.0F;
    214     __asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
    215     return res;
    216 #endif
    217   }
    218 
    219   __CRT_INLINE long double __cdecl fabsl (long double x)
    220   {
    221 #ifdef __arm__
    222     return __builtin_fabsl (x);
    223 #else
    224     long double res = 0.0l;
    225     __asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
    226     return res;
    227 #endif
    228   }
    229 
    230   __CRT_INLINE double __cdecl fabs (double x)
    231   {
    232 #if defined(__x86_64__) || defined(__arm__)
    233     return __builtin_fabs (x);
    234 #else
    235     double res = 0.0;
    236     __asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
    237     return res;
    238 #endif
    239   }
    240 #endif
    241 #endif
    242 
    243   double __cdecl ldexp(double _X,int _Y);
    244   double __cdecl frexp(double _X,int *_Y);
    245   double __cdecl modf(double _X,double *_Y);
    246   double __cdecl fmod(double _X,double _Y);
    247 
    248   void __cdecl sincos (double __x, double *p_sin, double *p_cos);
    249   void __cdecl sincosl (long double __x, long double *p_sin, long double *p_cos);
    250   void __cdecl sincosf (float __x, float *p_sin, float *p_cos);
    251 
    252 #ifndef _CRT_ABS_DEFINED
    253 #define _CRT_ABS_DEFINED
    254   int __cdecl abs(int _X);
    255   long __cdecl labs(long _X);
    256 #endif
    257 #ifndef _CRT_ATOF_DEFINED
    258 #define _CRT_ATOF_DEFINED
    259   double __cdecl atof(const char *_String);
    260   double __cdecl _atof_l(const char *_String,_locale_t _Locale);
    261 #endif
    262 
    263 #define EDOM 33
    264 #define ERANGE 34
    265 
    266 #ifndef __STRICT_ANSI__
    267 
    268 #ifndef _COMPLEX_DEFINED
    269 #define _COMPLEX_DEFINED
    270   struct _complex {
    271     double x;
    272     double y;
    273   };
    274 #endif
    275 
    276   double __cdecl _cabs(struct _complex _ComplexA); /* Overriden to use our cabs.  */
    277   double __cdecl _hypot(double _X,double _Y);
    278   _CRTIMP double __cdecl _j0(double _X);
    279   _CRTIMP double __cdecl _j1(double _X);
    280   _CRTIMP double __cdecl _jn(int _X,double _Y);
    281   _CRTIMP double __cdecl _y0(double _X);
    282   _CRTIMP double __cdecl _y1(double _X);
    283   _CRTIMP double __cdecl _yn(int _X,double _Y);
    284 #ifndef _CRT_MATHERR_DEFINED
    285 #define _CRT_MATHERR_DEFINED
    286   _CRTIMP int __cdecl _matherr (struct _exception *);
    287 #endif
    288 
    289 /* These are also declared in Mingw float.h; needed here as well to work
    290    around GCC build issues.  */
    291 /* BEGIN FLOAT.H COPY */
    292 /*
    293  * IEEE recommended functions
    294  */
    295 #ifndef _SIGN_DEFINED
    296 #define _SIGN_DEFINED
    297   _CRTIMP double __cdecl _chgsign (double _X);
    298   _CRTIMP double __cdecl _copysign (double _Number,double _Sign);
    299   _CRTIMP double __cdecl _logb (double);
    300   _CRTIMP double __cdecl _nextafter (double, double);
    301   _CRTIMP double __cdecl _scalb (double, long);
    302   _CRTIMP int __cdecl _finite (double);
    303   _CRTIMP int __cdecl _fpclass (double);
    304   _CRTIMP int __cdecl _isnan (double);
    305 #endif
    306 
    307 /* END FLOAT.H COPY */
    308 
    309 #if !defined(NO_OLDNAMES)
    310 
    311 _CRTIMP double __cdecl j0 (double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    312 _CRTIMP double __cdecl j1 (double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    313 _CRTIMP double __cdecl jn (int, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    314 _CRTIMP double __cdecl y0 (double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    315 _CRTIMP double __cdecl y1 (double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    316 _CRTIMP double __cdecl yn (int, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
    317 
    318 _CRTIMP double __cdecl chgsign (double);
    319 /*
    320  * scalb() is a GCC built-in.
    321  * Exclude this _scalb() stub; the semantics are incompatible
    322  * with the built-in implementation.
    323  *
    324 _CRTIMP double __cdecl scalb (double, long);
    325  *
    326  */
    327   _CRTIMP int __cdecl finite (double);
    328   _CRTIMP int __cdecl fpclass (double);
    329 
    330 #define FP_SNAN    _FPCLASS_SNAN
    331 #define FP_QNAN    _FPCLASS_QNAN
    332 #define FP_NINF    _FPCLASS_NINF
    333 #define FP_PINF    _FPCLASS_PINF
    334 #define FP_NDENORM _FPCLASS_ND
    335 #define FP_PDENORM _FPCLASS_PD
    336 #define FP_NZERO   _FPCLASS_NZ
    337 #define FP_PZERO   _FPCLASS_PZ
    338 #define FP_NNORM   _FPCLASS_NN
    339 #define FP_PNORM   _FPCLASS_PN
    340 
    341 #endif /* !defined (_NO_OLDNAMES) && !define (NO_OLDNAMES) */
    342 
    343 #if(defined(_X86_) && !defined(__x86_64))
    344   _CRTIMP int __cdecl _set_SSE2_enable(int _Flag);
    345 #endif
    346 
    347 #endif
    348 
    349 #ifndef __NO_ISOCEXT
    350 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
    351 	|| !defined __STRICT_ANSI__ || defined __cplusplus
    352 
    353 #ifdef __GNUC__
    354 #define HUGE_VALF	__builtin_huge_valf()
    355 #define HUGE_VALL	__builtin_huge_vall()
    356 #define INFINITY	__builtin_inf()
    357 #define NAN		__builtin_nan("")
    358 #else
    359 extern const float __INFF;
    360 #define HUGE_VALF __INFF
    361 extern const long double  __INFL;
    362 #define HUGE_VALL __INFL
    363 #define INFINITY HUGE_VALF
    364 extern const double __QNAN;
    365 #define NAN __QNAN
    366 #endif /* __GNUC__ */
    367 
    368 /* Use the compiler's builtin define for FLT_EVAL_METHOD to
    369    set float_t and double_t.  */
    370 #if defined (__x86_64__) || defined(__FLT_EVAL_METHOD__)
    371 # if defined (__x86_64__) || ( __FLT_EVAL_METHOD__== 0)
    372 typedef float float_t;
    373 typedef double double_t;
    374 # elif (__FLT_EVAL_METHOD__ == 1)
    375 typedef double float_t;
    376 typedef double double_t;
    377 # else /* (__FLT_EVAL_METHOD__ == 2) default ix87 FPU */
    378 typedef long double float_t;
    379 typedef long double double_t;
    380 #endif
    381 #else /* ix87 FPU default */
    382 typedef long double float_t;
    383 typedef long double double_t;
    384 #endif
    385 
    386 /* 7.12.3.1 */
    387 /*
    388    Return values for fpclassify.
    389    These are based on Intel x87 fpu condition codes
    390    in the high byte of status word and differ from
    391    the return values for MS IEEE 754 extension _fpclass()
    392 */
    393 #define FP_NAN		0x0100
    394 #define FP_NORMAL	0x0400
    395 #define FP_INFINITE	(FP_NAN | FP_NORMAL)
    396 #define FP_ZERO		0x4000
    397 #define FP_SUBNORMAL	(FP_NORMAL | FP_ZERO)
    398 /* 0x0200 is signbit mask */
    399 
    400 /*
    401   We can't inline float or double, because we want to ensure truncation
    402   to semantic type before classification.
    403   (A normal long double value might become subnormal when
    404   converted to double, and zero when converted to float.)
    405 */
    406 
    407   extern int __cdecl __fpclassifyl (long double);
    408   extern int __cdecl __fpclassifyf (float);
    409   extern int __cdecl __fpclassify (double);
    410 
    411 #ifndef __CRT__NO_INLINE
    412   __CRT_INLINE int __cdecl __fpclassifyl (long double x) {
    413 #if defined(__x86_64__) || defined(_AMD64_)
    414     __mingw_fp_types_t hlp;
    415     unsigned int e;
    416     hlp.ld = &x;
    417     e = hlp.ldt->lh.sign_exponent & 0x7fff;
    418     if (!e)
    419       {
    420         unsigned int h = hlp.ldt->lh.high;
    421         if (!(hlp.ldt->lh.low | h))
    422           return FP_ZERO;
    423         else if (!(h & 0x80000000))
    424           return FP_SUBNORMAL;
    425       }
    426     else if (e == 0x7fff)
    427       return (((hlp.ldt->lh.high & 0x7fffffff) | hlp.ldt->lh.low) == 0 ?
    428               FP_INFINITE : FP_NAN);
    429     return FP_NORMAL;
    430 #elif defined(__arm__) || defined(_ARM_)
    431     return __fpclassify(x);
    432 #elif defined(__i386__) || defined(_X86_)
    433     unsigned short sw;
    434     __asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
    435     return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
    436 #endif
    437   }
    438   __CRT_INLINE int __cdecl __fpclassify (double x) {
    439 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    440     __mingw_fp_types_t hlp;
    441     unsigned int l, h;
    442 
    443     hlp.d = &x;
    444     h = hlp.ldt->lh.high;
    445     l = hlp.ldt->lh.low | (h & 0xfffff);
    446     h &= 0x7ff00000;
    447     if ((h | l) == 0)
    448       return FP_ZERO;
    449     if (!h)
    450       return FP_SUBNORMAL;
    451     if (h == 0x7ff00000)
    452       return (l ? FP_NAN : FP_INFINITE);
    453     return FP_NORMAL;
    454 #elif defined(__i386__) || defined(_X86_)
    455     unsigned short sw;
    456     __asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
    457     return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
    458 #endif
    459   }
    460   __CRT_INLINE int __cdecl __fpclassifyf (float x) {
    461 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    462     __mingw_fp_types_t hlp;
    463 
    464     hlp.f = &x;
    465     hlp.ft->val &= 0x7fffffff;
    466     if (hlp.ft->val == 0)
    467       return FP_ZERO;
    468     if (hlp.ft->val < 0x800000)
    469       return FP_SUBNORMAL;
    470     if (hlp.ft->val >= 0x7f800000)
    471       return (hlp.ft->val > 0x7f800000 ? FP_NAN : FP_INFINITE);
    472     return FP_NORMAL;
    473 #elif defined(__i386__) || defined(_X86_)
    474     unsigned short sw;
    475     __asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
    476     return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
    477 #endif
    478   }
    479 #endif
    480 
    481 #ifdef __STDC_WANT_DEC_FP__
    482 #define __dfp_expansion(__call,__fin,x) \
    483 __mingw_choose_expr (                                  \
    484       __mingw_types_compatible_p (__typeof__ (x), _Decimal32),    \
    485         __call##d32(x),                                         \
    486     __mingw_choose_expr (                                     \
    487       __mingw_types_compatible_p (__typeof__ (x), _Decimal64),    \
    488         __call##d64(x),                                         \
    489     __mingw_choose_expr (                                     \
    490       __mingw_types_compatible_p (__typeof__ (x), _Decimal128),   \
    491         __call##d128(x),                                        \
    492 __fin)))
    493 #else
    494 #define __dfp_expansion(__call,__fin,x) __fin
    495 #endif
    496 
    497 #define fpclassify(x) \
    498 __mingw_choose_expr (                                         \
    499   __mingw_types_compatible_p (__typeof__ (x), double),            \
    500     __fpclassify(x),                                            \
    501     __mingw_choose_expr (                                     \
    502       __mingw_types_compatible_p (__typeof__ (x), float),         \
    503         __fpclassifyf(x),                                       \
    504     __mingw_choose_expr (                                     \
    505       __mingw_types_compatible_p (__typeof__ (x), long double),   \
    506         __fpclassifyl(x),                                       \
    507     __dfp_expansion(__fpclassify,(__builtin_trap(),0),x))))
    508 
    509 
    510 /* 7.12.3.2 */
    511 #define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
    512 
    513 /* 7.12.3.3 */
    514 #define isinf(x) (fpclassify(x) == FP_INFINITE)
    515 
    516 /* 7.12.3.4 */
    517 /* We don't need to worry about truncation here:
    518    A NaN stays a NaN. */
    519 
    520   extern int __cdecl __isnan (double);
    521   extern int __cdecl __isnanf (float);
    522   extern int __cdecl __isnanl (long double);
    523 
    524 #ifndef __CRT__NO_INLINE
    525   __CRT_INLINE int __cdecl __isnan (double _x)
    526   {
    527 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    528     __mingw_fp_types_t hlp;
    529     int l, h;
    530 
    531     hlp.d = &_x;
    532     l = hlp.dt->lh.low;
    533     h = hlp.dt->lh.high & 0x7fffffff;
    534     h |= (unsigned int) (l | -l) >> 31;
    535     h = 0x7ff00000 - h;
    536     return (int) ((unsigned int) h) >> 31;
    537 #elif defined(__i386__) || defined(_X86_)
    538     unsigned short sw;
    539     __asm__ __volatile__ ("fxam;"
    540       "fstsw %%ax": "=a" (sw) : "t" (_x));
    541     return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
    542       == FP_NAN;
    543 #endif
    544   }
    545 
    546   __CRT_INLINE int __cdecl __isnanf (float _x)
    547   {
    548 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    549     __mingw_fp_types_t hlp;
    550     int i;
    551 
    552     hlp.f = &_x;
    553     i = hlp.ft->val & 0x7fffffff;
    554     i = 0x7f800000 - i;
    555     return (int) (((unsigned int) i) >> 31);
    556 #elif defined(__i386__) || defined(_X86_)
    557     unsigned short sw;
    558     __asm__ __volatile__ ("fxam;"
    559       "fstsw %%ax": "=a" (sw) : "t" (_x));
    560     return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
    561       == FP_NAN;
    562 #endif
    563   }
    564 
    565   __CRT_INLINE int __cdecl __isnanl (long double _x)
    566   {
    567 #if defined(__x86_64__) || defined(_AMD64_)
    568     __mingw_fp_types_t ld;
    569     int xx, signexp;
    570 
    571     ld.ld = &_x;
    572     signexp = (ld.ldt->lh.sign_exponent & 0x7fff) << 1;
    573     xx = (int) (ld.ldt->lh.low | (ld.ldt->lh.high & 0x7fffffffu)); /* explicit */
    574     signexp |= (unsigned int) (xx | (-xx)) >> 31;
    575     signexp = 0xfffe - signexp;
    576     return (int) ((unsigned int) signexp) >> 16;
    577 #elif defined(__arm__) || defined(_ARM_)
    578     __isnan(_x);
    579 #elif defined(__i386__) || defined(_X86_)
    580     unsigned short sw;
    581     __asm__ __volatile__ ("fxam;"
    582       "fstsw %%ax": "=a" (sw) : "t" (_x));
    583     return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
    584       == FP_NAN;
    585 #endif
    586   }
    587 #endif
    588 
    589 
    590 
    591 #define isnan(x) \
    592 __mingw_choose_expr (                                         \
    593   __mingw_types_compatible_p (__typeof__ (x), double),            \
    594     __isnan(x),                                                 \
    595     __mingw_choose_expr (                                     \
    596       __mingw_types_compatible_p (__typeof__ (x), float),         \
    597         __isnanf(x),                                            \
    598     __mingw_choose_expr (                                     \
    599       __mingw_types_compatible_p (__typeof__ (x), long double),   \
    600         __isnanl(x),                                            \
    601     __dfp_expansion(__isnan,(__builtin_trap(),x),x))))
    602 
    603 /* 7.12.3.5 */
    604 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
    605 
    606 /* 7.12.3.6 The signbit macro */
    607   extern int __cdecl __signbit (double);
    608   extern int __cdecl __signbitf (float);
    609   extern int __cdecl __signbitl (long double);
    610 #ifndef __CRT__NO_INLINE
    611   __CRT_INLINE int __cdecl __signbit (double x) {
    612 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    613     __mingw_fp_types_t hlp;
    614 
    615     hlp.d = &x;
    616     return ((hlp.dt->lh.high & 0x80000000) != 0);
    617 #elif defined(__i386__) || defined(_X86_)
    618     unsigned short stw;
    619     __asm__ __volatile__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
    620     return stw & 0x0200;
    621 #endif
    622   }
    623 
    624   __CRT_INLINE int __cdecl __signbitf (float x) {
    625 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    626     __mingw_fp_types_t hlp;
    627     hlp.f = &x;
    628     return ((hlp.ft->val & 0x80000000) != 0);
    629 #elif defined(__i386__) || defined(_X86_)
    630     unsigned short stw;
    631     __asm__ __volatile__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
    632     return stw & 0x0200;
    633 #endif
    634   }
    635 
    636   __CRT_INLINE int __cdecl __signbitl (long double x) {
    637 #if defined(__x86_64__) || defined(_AMD64_)
    638     __mingw_fp_types_t ld;
    639     ld.ld = &x;
    640     return ((ld.ldt->lh.sign_exponent & 0x8000) != 0);
    641 #elif defined(__arm__) || defined(_ARM_)
    642     __signbit(x);
    643 #elif defined(__i386__) || defined(_X86_)
    644     unsigned short stw;
    645     __asm__ __volatile__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
    646     return stw & 0x0200;
    647 #endif
    648   }
    649 #endif
    650 
    651 #define signbit(x) \
    652 __mingw_choose_expr (                                         \
    653   __mingw_types_compatible_p (__typeof__ (x), double),            \
    654     __signbit(x),                                               \
    655     __mingw_choose_expr (                                     \
    656       __mingw_types_compatible_p (__typeof__ (x), float),         \
    657         __signbitf(x),                                          \
    658     __mingw_choose_expr (                                     \
    659       __mingw_types_compatible_p (__typeof__ (x), long double),   \
    660         __signbitl(x),                                          \
    661      __dfp_expansion(__signbit,(__builtin_trap(),x),x))))
    662 
    663 /* 7.12.4 Trigonometric functions: Double in C89 */
    664   extern float __cdecl sinf(float _X);
    665   extern long double __cdecl sinl(long double);
    666 
    667   extern float __cdecl cosf(float _X);
    668   extern long double __cdecl cosl(long double);
    669 
    670   extern float __cdecl tanf(float _X);
    671   extern long double __cdecl tanl(long double);
    672   extern float __cdecl asinf(float _X);
    673   extern long double __cdecl asinl(long double);
    674 
    675   extern float __cdecl acosf (float);
    676   extern long double __cdecl acosl (long double);
    677 
    678   extern float __cdecl atanf (float);
    679   extern long double __cdecl atanl (long double);
    680 
    681   extern float __cdecl atan2f (float, float);
    682   extern long double __cdecl atan2l (long double, long double);
    683 
    684 /* 7.12.5 Hyperbolic functions: Double in C89  */
    685   extern float __cdecl sinhf(float _X);
    686 #ifndef __CRT__NO_INLINE
    687   __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); }
    688 #endif
    689   extern long double __cdecl sinhl(long double);
    690 
    691   extern float __cdecl coshf(float _X);
    692 #ifndef __CRT__NO_INLINE
    693   __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); }
    694 #endif
    695   extern long double __cdecl coshl(long double);
    696 
    697   extern float __cdecl tanhf(float _X);
    698 #ifndef __CRT__NO_INLINE
    699   __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); }
    700 #endif
    701   extern long double __cdecl tanhl(long double);
    702 
    703 /* Inverse hyperbolic trig functions  */
    704 /* 7.12.5.1 */
    705   extern double __cdecl acosh (double);
    706   extern float __cdecl acoshf (float);
    707   extern long double __cdecl acoshl (long double);
    708 
    709 /* 7.12.5.2 */
    710   extern double __cdecl asinh (double);
    711   extern float __cdecl asinhf (float);
    712   extern long double __cdecl asinhl (long double);
    713 
    714 /* 7.12.5.3 */
    715   extern double __cdecl atanh (double);
    716   extern float __cdecl atanhf  (float);
    717   extern long double __cdecl atanhl (long double);
    718 
    719 /* Exponentials and logarithms  */
    720 /* 7.12.6.1 Double in C89 */
    721   extern float __cdecl expf(float _X);
    722 #ifndef __CRT__NO_INLINE
    723   __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); }
    724 #endif
    725   extern long double __cdecl expl(long double);
    726 
    727 /* 7.12.6.2 */
    728   extern double __cdecl exp2(double);
    729   extern float __cdecl exp2f(float);
    730   extern long double __cdecl exp2l(long double);
    731 
    732 /* 7.12.6.3 The expm1 functions */
    733 /* TODO: These could be inlined */
    734   extern double __cdecl expm1(double);
    735   extern float __cdecl expm1f(float);
    736   extern long double __cdecl expm1l(long double);
    737 
    738 /* 7.12.6.4 Double in C89 */
    739   extern float frexpf(float _X,int *_Y);
    740 #ifndef __CRT__NO_INLINE
    741   __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
    742 #endif
    743   extern long double __cdecl frexpl(long double,int *);
    744 
    745 /* 7.12.6.5 */
    746 #define FP_ILOGB0 ((int)0x80000000)
    747 #define FP_ILOGBNAN ((int)0x80000000)
    748   extern int __cdecl ilogb (double);
    749   extern int __cdecl ilogbf (float);
    750   extern int __cdecl ilogbl (long double);
    751 
    752 /* 7.12.6.6  Double in C89 */
    753   extern float __cdecl ldexpf(float _X,int _Y);
    754 #ifndef __CRT__NO_INLINE
    755   __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp ((double)x, expn); }
    756 #endif
    757   extern long double __cdecl ldexpl (long double, int);
    758 
    759 /* 7.12.6.7 Double in C89 */
    760   extern float __cdecl logf (float);
    761   extern long double __cdecl logl(long double);
    762 
    763 /* 7.12.6.8 Double in C89 */
    764   extern float __cdecl log10f (float);
    765   extern long double __cdecl log10l(long double);
    766 
    767 /* 7.12.6.9 */
    768   extern double __cdecl log1p(double);
    769   extern float __cdecl log1pf(float);
    770   extern long double __cdecl log1pl(long double);
    771 
    772 /* 7.12.6.10 */
    773   extern double __cdecl log2 (double);
    774   extern float __cdecl log2f (float);
    775   extern long double __cdecl log2l (long double);
    776 
    777 /* 7.12.6.11 */
    778   extern double __cdecl logb (double);
    779   extern float __cdecl logbf (float);
    780   extern long double __cdecl logbl (long double);
    781 
    782 #ifndef __CRT__NO_INLINE
    783 /* When compiling with gcc, always use gcc's builtins.
    784  * The asm inlines below are kept here for future reference:
    785  * they were written for gcc and do no error handling
    786  * (exceptions/errno), therefore only valid if __FAST_MATH__
    787  * is defined (-ffast-math) .  */
    788 #if 0 /*defined(__GNUC__) && defined(__FAST_MATH__)*/
    789   __CRT_INLINE double __cdecl logb (double x)
    790   {
    791 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    792   __mingw_fp_types_t hlp;
    793   int lx, hx;
    794 
    795   hlp.d = &x;
    796   lx = hlp.dt->lh.low;
    797   hx = hlp.dt->lh.high & 0x7fffffff; /* high |x| */
    798   if ((hx | lx) == 0)
    799     return -1.0 / fabs (x);
    800   if (hx >= 0x7ff00000)
    801     return x * x;
    802   if ((hx >>= 20) == 0) /* IEEE 754 logb */
    803     return -1022.0;
    804   return (double) (hx - 1023);
    805 #elif defined(__i386__) || defined(_X86_)
    806     double res = 0.0;
    807     __asm__ __volatile__ ("fxtract\n\t"
    808       "fstp	%%st" : "=t" (res) : "0" (x));
    809     return res;
    810 #endif
    811   }
    812 
    813   __CRT_INLINE float __cdecl logbf (float x)
    814   {
    815 #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_)
    816     int v;
    817     __mingw_fp_types_t hlp;
    818 
    819     hlp.f = &x;
    820     v = hlp.ft->val & 0x7fffffff;                     /* high |x| */
    821     if (!v)
    822       return (float)-1.0 / fabsf (x);
    823     if (v >= 0x7f800000)
    824     return x * x;
    825   if ((v >>= 23) == 0) /* IEEE 754 logb */
    826     return -126.0;
    827   return (float) (v - 127);
    828 #elif defined(__i386__) || defined(_X86_)
    829     float res = 0.0F;
    830     __asm__ __volatile__ ("fxtract\n\t"
    831       "fstp	%%st" : "=t" (res) : "0" (x));
    832     return res;
    833 #endif
    834   }
    835 
    836   __CRT_INLINE long double __cdecl logbl (long double x)
    837   {
    838 #if defined(__arm__) || defined(_ARM_)
    839   __mingw_fp_types_t hlp;
    840   int lx, hx;
    841 
    842   hlp.d = &x;
    843   lx = hlp.dt->lh.low;
    844   hx = hlp.dt->lh.high & 0x7fffffff; /* high |x| */
    845   if ((hx | lx) == 0)
    846     return -1.0 / fabs (x);
    847   if (hx >= 0x7ff00000)
    848     return x * x;
    849   if ((hx >>= 20) == 0) /* IEEE 754 logb */
    850     return -1022.0;
    851   return (double) (hx - 1023);
    852 #elif defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_)
    853     long double res = 0.0l;
    854     __asm__ __volatile__ ("fxtract\n\t"
    855       "fstp	%%st" : "=t" (res) : "0" (x));
    856     return res;
    857 #endif
    858   }
    859 #endif /* defined(__GNUC__) && defined(__FAST_MATH__) */
    860 #endif /* __CRT__NO_INLINE */
    861 
    862 /* 7.12.6.12  Double in C89 */
    863   extern float __cdecl modff (float, float*);
    864   extern long double __cdecl modfl (long double, long double*);
    865 
    866 /* 7.12.6.13 */
    867   extern double __cdecl scalbn (double, int);
    868   extern float __cdecl scalbnf (float, int);
    869   extern long double __cdecl scalbnl (long double, int);
    870 
    871   extern double __cdecl scalbln (double, long);
    872   extern float __cdecl scalblnf (float, long);
    873   extern long double __cdecl scalblnl (long double, long);
    874 
    875 /* 7.12.7.1 */
    876 /* Implementations adapted from Cephes versions */
    877   extern double __cdecl cbrt (double);
    878   extern float __cdecl cbrtf (float);
    879   extern long double __cdecl cbrtl (long double);
    880 
    881 /* 7.12.7.3  */
    882   extern double __cdecl hypot (double, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005; /* in libmoldname.a */
    883   extern float __cdecl hypotf (float x, float y);
    884 #ifndef __CRT__NO_INLINE
    885   __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot ((double)x, (double)y);}
    886 #endif
    887   extern long double __cdecl hypotl (long double, long double);
    888 
    889 /* 7.12.7.4 The pow functions. Double in C89 */
    890   extern float __cdecl powf(float _X,float _Y);
    891 #ifndef __CRT__NO_INLINE
    892   __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); }
    893 #endif
    894   extern long double __cdecl powl (long double, long double);
    895 
    896 /* 7.12.7.5 The sqrt functions. Double in C89. */
    897   extern float __cdecl sqrtf (float);
    898   extern long double sqrtl(long double);
    899 
    900 /* 7.12.8.1 The erf functions  */
    901   extern double __cdecl erf (double);
    902   extern float __cdecl erff (float);
    903   extern long double __cdecl erfl (long double);
    904 
    905 /* 7.12.8.2 The erfc functions  */
    906   extern double __cdecl erfc (double);
    907   extern float __cdecl erfcf (float);
    908   extern long double __cdecl erfcl (long double);
    909 
    910 /* 7.12.8.3 The lgamma functions */
    911   extern double __cdecl lgamma (double);
    912   extern float __cdecl lgammaf (float);
    913   extern long double __cdecl lgammal (long double);
    914 
    915   extern int signgam;
    916 
    917 /* 7.12.8.4 The tgamma functions */
    918   extern double __cdecl tgamma (double);
    919   extern float __cdecl tgammaf (float);
    920   extern long double __cdecl tgammal (long double);
    921 
    922 /* 7.12.9.1 Double in C89 */
    923   extern float __cdecl ceilf (float);
    924   extern long double __cdecl ceill (long double);
    925 
    926 /* 7.12.9.2 Double in C89 */
    927   extern float __cdecl floorf (float);
    928   extern long double __cdecl floorl (long double);
    929 
    930 /* 7.12.9.3 */
    931   extern double __cdecl nearbyint ( double);
    932   extern float __cdecl nearbyintf (float);
    933   extern long double __cdecl nearbyintl (long double);
    934 
    935 /* 7.12.9.4 */
    936 /* round, using fpu control word settings */
    937 extern double __cdecl rint (double);
    938 extern float __cdecl rintf (float);
    939 extern long double __cdecl rintl (long double);
    940 
    941 /* 7.12.9.5 */
    942 extern long __cdecl lrint (double);
    943 extern long __cdecl lrintf (float);
    944 extern long __cdecl lrintl (long double);
    945 
    946 __MINGW_EXTENSION long long __cdecl llrint (double);
    947 __MINGW_EXTENSION long long __cdecl llrintf (float);
    948 __MINGW_EXTENSION long long __cdecl llrintl (long double);
    949 
    950 #ifndef __CRT__NO_INLINE
    951 /* When compiling with gcc, always use gcc's builtins.
    952  * The asm inlines below are kept here for future reference:
    953  * they were written for gcc and do no error handling
    954  * (exceptions/errno), therefore only valid if __FAST_MATH__
    955  * is defined (-ffast-math) .  */
    956 #if 0 /*defined(__GNUC__) && defined(__FAST_MATH__)*/
    957   __CRT_INLINE double __cdecl rint (double x)
    958   {
    959     double retval = 0.0;
    960     __asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
    961     return retval;
    962   }
    963 
    964   __CRT_INLINE float __cdecl rintf (float x)
    965   {
    966     float retval = 0.0;
    967     __asm__ __volatile__ ("frndint;" : "=t" (retval) : "0" (x) );
    968     return retval;
    969   }
    970 
    971   __CRT_INLINE long double __cdecl rintl (long double x)
    972   {
    973     long double retval = 0.0l;
    974     __asm__ __volatile__ ("frndint;" : "=t" (retval) : "0" (x) );
    975     return retval;
    976   }
    977 
    978   __CRT_INLINE long __cdecl lrint (double x)
    979   {
    980     long retval = 0;
    981     __asm__ __volatile__							      \
    982       ("fistpl %0"  : "=m" (retval) : "t" (x) : "st");				      \
    983       return retval;
    984   }
    985 
    986   __CRT_INLINE long __cdecl lrintf (float x)
    987   {
    988     long retval = 0;
    989     __asm__ __volatile__							      \
    990       ("fistpl %0"  : "=m" (retval) : "t" (x) : "st");				      \
    991       return retval;
    992   }
    993 
    994   __CRT_INLINE long __cdecl lrintl (long double x)
    995   {
    996     long retval = 0;
    997     __asm__ __volatile__							      \
    998       ("fistpl %0"  : "=m" (retval) : "t" (x) : "st");				      \
    999       return retval;
   1000   }
   1001 
   1002   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llrint (double x)
   1003   {
   1004     __MINGW_EXTENSION long long retval = 0ll;
   1005     __asm__ __volatile__							      \
   1006       ("fistpll %0"  : "=m" (retval) : "t" (x) : "st");				      \
   1007       return retval;
   1008   }
   1009 
   1010   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llrintf (float x)
   1011   {
   1012     __MINGW_EXTENSION long long retval = 0ll;
   1013     __asm__ __volatile__							      \
   1014       ("fistpll %0"  : "=m" (retval) : "t" (x) : "st");				      \
   1015       return retval;
   1016   }
   1017 
   1018   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llrintl (long double x)
   1019   {
   1020     __MINGW_EXTENSION long long retval = 0ll;
   1021     __asm__ __volatile__							      \
   1022       ("fistpll %0"  : "=m" (retval) : "t" (x) : "st");				      \
   1023       return retval;
   1024   }
   1025 #endif /* defined(__GNUC__) && defined(__FAST_MATH__) */
   1026 #endif /* !__CRT__NO_INLINE */
   1027 
   1028 /* 7.12.9.6 */
   1029 /* round away from zero, regardless of fpu control word settings */
   1030   extern double __cdecl round (double);
   1031   extern float __cdecl roundf (float);
   1032   extern long double __cdecl roundl (long double);
   1033 
   1034 /* 7.12.9.7  */
   1035   extern long __cdecl lround (double);
   1036   extern long __cdecl lroundf (float);
   1037   extern long __cdecl lroundl (long double);
   1038   __MINGW_EXTENSION long long __cdecl llround (double);
   1039   __MINGW_EXTENSION long long __cdecl llroundf (float);
   1040   __MINGW_EXTENSION long long __cdecl llroundl (long double);
   1041 
   1042 /* 7.12.9.8 */
   1043 /* round towards zero, regardless of fpu control word settings */
   1044   extern double __cdecl trunc (double);
   1045   extern float __cdecl truncf (float);
   1046   extern long double __cdecl truncl (long double);
   1047 
   1048 /* 7.12.10.1 Double in C89 */
   1049   extern float __cdecl fmodf (float, float);
   1050   extern long double __cdecl fmodl (long double, long double);
   1051 
   1052 /* 7.12.10.2 */
   1053   extern double __cdecl remainder (double, double);
   1054   extern float __cdecl remainderf (float, float);
   1055   extern long double __cdecl remainderl (long double, long double);
   1056 
   1057 /* 7.12.10.3 */
   1058   extern double __cdecl remquo(double, double, int *);
   1059   extern float __cdecl remquof(float, float, int *);
   1060   extern long double __cdecl remquol(long double, long double, int *);
   1061 
   1062 /* 7.12.11.1 */
   1063   extern double __cdecl copysign (double, double); /* in libmoldname.a */
   1064   extern float __cdecl copysignf (float, float);
   1065   extern long double __cdecl copysignl (long double, long double);
   1066 
   1067 #ifndef __CRT__NO_INLINE
   1068 #if !defined (__ia64__)
   1069   __CRT_INLINE double __cdecl copysign (double x, double y)
   1070   {
   1071     __mingw_dbl_type_t hx, hy;
   1072     hx.x = x; hy.x = y;
   1073     hx.lh.high = (hx.lh.high & 0x7fffffff) | (hy.lh.high & 0x80000000);
   1074     return hx.x;
   1075   }
   1076   __CRT_INLINE float __cdecl copysignf (float x, float y)
   1077   {
   1078     __mingw_flt_type_t hx, hy;
   1079     hx.x = x; hy.x = y;
   1080     hx.val = (hx.val & 0x7fffffff) | (hy.val & 0x80000000);
   1081     return hx.x;
   1082   }
   1083 #endif
   1084 #endif
   1085 
   1086 /* 7.12.11.2 Return a NaN */
   1087   extern double __cdecl nan(const char *tagp);
   1088   extern float __cdecl nanf(const char *tagp);
   1089   extern long double __cdecl nanl(const char *tagp);
   1090 
   1091 #ifndef __STRICT_ANSI__
   1092 #define _nan() nan("")
   1093 #define _nanf() nanf("")
   1094 #define _nanl() nanl("")
   1095 #endif
   1096 
   1097 /* 7.12.11.3 */
   1098   extern double __cdecl nextafter (double, double); /* in libmoldname.a */
   1099   extern float __cdecl nextafterf (float, float);
   1100   extern long double __cdecl nextafterl (long double, long double);
   1101 
   1102 /* 7.12.11.4 The nexttoward functions */
   1103   extern double __cdecl nexttoward (double,  long double);
   1104   extern float __cdecl nexttowardf (float,  long double);
   1105   extern long double __cdecl nexttowardl (long double, long double);
   1106 
   1107 /* 7.12.12.1 */
   1108 /*  x > y ? (x - y) : 0.0  */
   1109   extern double __cdecl fdim (double x, double y);
   1110   extern float __cdecl fdimf (float x, float y);
   1111   extern long double __cdecl fdiml (long double x, long double y);
   1112 
   1113 /* fmax and fmin.
   1114    NaN arguments are treated as missing data: if one argument is a NaN
   1115    and the other numeric, then these functions choose the numeric
   1116    value. */
   1117 
   1118 /* 7.12.12.2 */
   1119   extern double __cdecl fmax  (double, double);
   1120   extern float __cdecl fmaxf (float, float);
   1121   extern long double __cdecl fmaxl (long double, long double);
   1122 
   1123 /* 7.12.12.3 */
   1124   extern double __cdecl fmin (double, double);
   1125   extern float __cdecl fminf (float, float);
   1126   extern long double __cdecl fminl (long double, long double);
   1127 
   1128 /* 7.12.13.1 */
   1129 /* return x * y + z as a ternary op */
   1130   extern double __cdecl fma (double, double, double);
   1131   extern float __cdecl fmaf (float, float, float);
   1132   extern long double __cdecl fmal (long double, long double, long double);
   1133 
   1134 /* 7.12.14 */
   1135 /*
   1136  *  With these functions, comparisons involving quiet NaNs set the FP
   1137  *  condition code to "unordered".  The IEEE floating-point spec
   1138  *  dictates that the result of floating-point comparisons should be
   1139  *  false whenever a NaN is involved, with the exception of the != op,
   1140  *  which always returns true: yes, (NaN != NaN) is true).
   1141  */
   1142 
   1143 #ifdef __GNUC__
   1144 
   1145 #define isgreater(x, y) __builtin_isgreater(x, y)
   1146 #define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
   1147 #define isless(x, y) __builtin_isless(x, y)
   1148 #define islessequal(x, y) __builtin_islessequal(x, y)
   1149 #define islessgreater(x, y) __builtin_islessgreater(x, y)
   1150 #define isunordered(x, y) __builtin_isunordered(x, y)
   1151 
   1152 #else
   1153 /*  helper  */
   1154 #ifndef __CRT__NO_INLINE
   1155   __CRT_INLINE int  __cdecl
   1156     __fp_unordered_compare (long double x, long double y){
   1157       unsigned short retval;
   1158       __asm__ __volatile__ ("fucom %%st(1);"
   1159 	"fnstsw;": "=a" (retval) : "t" (x), "u" (y));
   1160       return retval;
   1161   }
   1162 #endif /* __GNUC__ */
   1163 
   1164 #define isgreater(x, y) ((__fp_unordered_compare(x, y)  & 0x4500) == 0)
   1165 #define isless(x, y) ((__fp_unordered_compare (y, x)  & 0x4500) == 0)
   1166 #define isgreaterequal(x, y) ((__fp_unordered_compare (x, y)  & FP_INFINITE) == 0)
   1167 #define islessequal(x, y) ((__fp_unordered_compare(y, x)  & FP_INFINITE) == 0)
   1168 #define islessgreater(x, y) ((__fp_unordered_compare(x, y)  & FP_SUBNORMAL) == 0)
   1169 #define isunordered(x, y) ((__fp_unordered_compare(x, y)  & 0x4500) == 0x4500)
   1170 
   1171 #endif
   1172 
   1173 #endif /* __STDC_VERSION__ >= 199901L */
   1174 #endif /* __NO_ISOCEXT */
   1175 
   1176 #if defined(_X86_) && !defined(__x86_64)
   1177   _CRTIMP float __cdecl _hypotf(float _X,float _Y);
   1178 #endif
   1179 
   1180 #if !defined(__ia64__)
   1181    _CRTIMP float __cdecl _copysignf (float _Number,float _Sign);
   1182    _CRTIMP float __cdecl _chgsignf (float _X);
   1183    _CRTIMP float __cdecl _logbf(float _X);
   1184    _CRTIMP float __cdecl _nextafterf(float _X,float _Y);
   1185    _CRTIMP int __cdecl _finitef(float _X);
   1186    _CRTIMP int __cdecl _isnanf(float _X);
   1187    _CRTIMP int __cdecl _fpclassf(float _X);
   1188 #endif
   1189 
   1190 #ifdef _SIGN_DEFINED
   1191    extern long double __cdecl _chgsignl (long double);
   1192 #define _copysignl copysignl
   1193 #endif /* _SIGN_DEFINED */
   1194 
   1195 #define _hypotl hypotl
   1196 
   1197 #ifndef	NO_OLDNAMES
   1198 #define matherr _matherr
   1199 #define HUGE	_HUGE
   1200 #endif
   1201 
   1202 /* Documentation on decimal float math
   1203    http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=8cf166fedd1aa110VgnVCM100000a360ea10RCRD
   1204  */
   1205 #ifdef __STDC_WANT_DEC_FP__
   1206 
   1207 #define DEC_INFINITY __builtin_infd32()
   1208 #define DEC_NAN __builtin_nand32("")
   1209 
   1210   extern int __cdecl __isnand32(_Decimal32 x);
   1211   extern int __cdecl __isnand64(_Decimal64 x);
   1212   extern int __cdecl __isnand128(_Decimal128 x);
   1213   extern int __cdecl __fpclassifyd32 (_Decimal32);
   1214   extern int __cdecl __fpclassifyd64 (_Decimal64);
   1215   extern int __cdecl __fpclassifyd128 (_Decimal128);
   1216   extern int __cdecl __signbitd32 (_Decimal32);
   1217   extern int __cdecl __signbitd64 (_Decimal64);
   1218   extern int __cdecl __signbitd128 (_Decimal128);
   1219 
   1220 #ifndef __CRT__NO_INLINE
   1221   __CRT_INLINE __cdecl __isnand32(_Decimal32 x){
   1222     return __builtin_isnand32(x);
   1223   }
   1224 
   1225   __CRT_INLINE __cdecl __isnand64(_Decimal64 x){
   1226     return __builtin_isnand64(x);
   1227   }
   1228 
   1229   __CRT_INLINE __cdecl __isnand128(_Decimal128 x){
   1230     return __builtin_isnand128(x);
   1231   }
   1232 
   1233   __CRT_INLINE int __cdecl __signbitd32 (_Decimal32 x){
   1234     return __buintin_signbitd32(x);
   1235   }
   1236 
   1237   __CRT_INLINE int __cdecl __signbitd64 (_Decimal64 x){
   1238     return __buintin_signbitd64(x);
   1239   }
   1240 
   1241   __CRT_INLINE int __cdecl __signbitd128 (_Decimal128 x){
   1242     return __buintin_signbitd128(x);
   1243   }
   1244 
   1245 #endif
   1246 
   1247 /* Still missing
   1248 #define HUGE_VAL_D32
   1249 #define HUGE_VAL_D64
   1250 #define HUGE_VAL_D128
   1251 */
   1252 
   1253 /*** exponentials ***/
   1254 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/expd64.3m.htm */
   1255 _Decimal64 __cdecl expd64(_Decimal64 _X);
   1256 _Decimal128 __cdecl expd128(_Decimal128 _X);
   1257 _Decimal32 __cdecl expd32(_Decimal32 _X);
   1258 
   1259 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/exp2d64.3m.htm */
   1260 _Decimal64 __cdecl exp2d64(_Decimal64 _X);
   1261 _Decimal128 __cdecl exp2d128(_Decimal128 _X);
   1262 _Decimal32 __cdecl exp2d32(_Decimal32 _X);
   1263 
   1264 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/exp10d64.3m.htm */
   1265 _Decimal64 __cdecl exp10d64(_Decimal64 _X);
   1266 _Decimal128 __cdecl exp10d128(_Decimal128 _X);
   1267 _Decimal32 __cdecl exp10d32(_Decimal32 _X);
   1268 
   1269 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/expm1d64.3m.htm */
   1270 _Decimal64 __cdecl expm1d64(_Decimal64 _X);
   1271 _Decimal128 __cdecl expm1d128(_Decimal128 _X);
   1272 _Decimal32 __cdecl expm1d32(_Decimal32 _X);
   1273 
   1274 /*** logarithms ***/
   1275 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/logd64.3m.htm */
   1276 _Decimal64 __cdecl logd64(_Decimal64 _X);
   1277 _Decimal128 __cdecl logd128(_Decimal128 _X);
   1278 _Decimal32 __cdecl logd32(_Decimal32 _X);
   1279 
   1280 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/log2d64.3m.htm */
   1281 _Decimal64 __cdecl log2d64(_Decimal64 _X);
   1282 _Decimal128 __cdecl log2d128(_Decimal128 _X);
   1283 _Decimal32 __cdecl log2d32(_Decimal32 _X);
   1284 
   1285 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/log10d64.3m.htm */
   1286 _Decimal64 __cdecl log10d64(_Decimal64 _X);
   1287 _Decimal128 __cdecl log10d128(_Decimal128 _X);
   1288 _Decimal32 __cdecl log10d32(_Decimal32 _X);
   1289 
   1290 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/log1pd64.3m.htm */
   1291 _Decimal64 __cdecl log1pd64(_Decimal64 _X);
   1292 _Decimal128 __cdecl log1pd128(_Decimal128 _X);
   1293 _Decimal32 __cdecl log1pd32(_Decimal32 _X);
   1294 
   1295 /*** trigonometrics ***/
   1296 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/cosd64.3m.htm */
   1297 _Decimal64 __cdecl cosd64(_Decimal64 _X);
   1298 _Decimal128 __cdecl cosd128(_Decimal128 _X);
   1299 _Decimal32 __cdecl cosd32(_Decimal32 _X);
   1300 
   1301 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/sind64.3m.htm */
   1302 _Decimal64 __cdecl sind64(_Decimal64 _X);
   1303 _Decimal128 __cdecl sind128(_Decimal128 _X);
   1304 _Decimal32 __cdecl sind32(_Decimal32 _X);
   1305 
   1306 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/tand64.3m.htm */
   1307 _Decimal64 __cdecl tand64(_Decimal64 _X);
   1308 _Decimal128 __cdecl tand128(_Decimal128 _X);
   1309 _Decimal32 __cdecl tand32(_Decimal32 _X);
   1310 
   1311 /*** inverse trigonometrics ***/
   1312 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/acosd64.3m.htm */
   1313 _Decimal64 __cdecl acosd64(_Decimal64 _X);
   1314 _Decimal128 __cdecl acosd128(_Decimal128 _X);
   1315 _Decimal32 __cdecl acosd32(_Decimal32 _X);
   1316 
   1317 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/asind64.3m.htm */
   1318 _Decimal64 __cdecl asind64(_Decimal64 _X);
   1319 _Decimal128 __cdecl asind128(_Decimal128 _X);
   1320 _Decimal32 __cdecl asind32(_Decimal32 _X);
   1321 
   1322 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/atand64.3m.htm */
   1323 _Decimal64 __cdecl atand64(_Decimal64 _X);
   1324 _Decimal128 __cdecl atand128(_Decimal128 _X);
   1325 _Decimal32 __cdecl atand32(_Decimal32 _X);
   1326 
   1327 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/atan2d64.3m.htm */
   1328 _Decimal64 __cdecl atan2d64(_Decimal64 _X, _Decimal64 _Y);
   1329 _Decimal128 __cdecl atan2d128(_Decimal128 _X, _Decimal128 _Y);
   1330 _Decimal32 __cdecl atan2d32(_Decimal32 _X, _Decimal32 _Y);
   1331 
   1332 /*** hyperbolics ***/
   1333 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/coshd64.3m.htm */
   1334 _Decimal64 __cdecl coshd64(_Decimal64 _X);
   1335 _Decimal128 __cdecl coshd128(_Decimal128 _X);
   1336 _Decimal32 __cdecl coshd32(_Decimal32 _X);
   1337 
   1338 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/sinhd64.3m.htm */
   1339 _Decimal64 __cdecl sinhd64(_Decimal64 _X);
   1340 _Decimal128 __cdecl sinhd128(_Decimal128 _X);
   1341 _Decimal32 __cdecl sinhd32(_Decimal32 _X);
   1342 
   1343 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/tanhd64.3m.htm */
   1344 _Decimal64 __cdecl tanhd64(_Decimal64 _X);
   1345 _Decimal128 __cdecl tanhd128(_Decimal128 _X);
   1346 _Decimal32 __cdecl tanhd32(_Decimal32 _X);
   1347 
   1348 /*** inverse hyperbolics ***/
   1349 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/acoshd64.3m.htm */
   1350 _Decimal64 __cdecl acoshd64(_Decimal64 _X);
   1351 _Decimal128 __cdecl acoshd128(_Decimal128 _X);
   1352 _Decimal32 __cdecl acoshd32(_Decimal32 _X);
   1353 
   1354 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/asinhd64.3m.htm */
   1355 _Decimal64 __cdecl asinhd64(_Decimal64 _X);
   1356 _Decimal128 __cdecl asinhd128(_Decimal128 _X);
   1357 _Decimal32 __cdecl asinhd32(_Decimal32 _X);
   1358 
   1359 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/atanhd64.3m.htm */
   1360 _Decimal64 __cdecl atanhd64(_Decimal64 _X);
   1361 _Decimal128 __cdecl atanhd128(_Decimal128 _X);
   1362 _Decimal32 __cdecl atanhd32(_Decimal32 _X);
   1363 
   1364 /*** square & cube roots, hypotenuse ***/
   1365 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/sqrtd64.3m.htm */
   1366 _Decimal64 __cdecl sqrtd64(_Decimal64 _X);
   1367 _Decimal128 __cdecl sqrtd128(_Decimal128 _X);
   1368 _Decimal32 __cdecl sqrtd32(_Decimal32 _X);
   1369 
   1370 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/cbrtd64.3m.htm */
   1371 _Decimal64 __cdecl cbrtd64(_Decimal64 _X);
   1372 _Decimal128 __cdecl cbrtd128(_Decimal128 _X);
   1373 _Decimal32 __cdecl cbrtd32(_Decimal32 _X);
   1374 
   1375 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/hypotd64.3m.htm */
   1376 _Decimal64 __cdecl hypotd64(_Decimal64 _X, _Decimal64 _Y);
   1377 _Decimal128 __cdecl hypotd128(_Decimal128 _X, _Decimal128 _Y);
   1378 _Decimal32 __cdecl hypotd32(_Decimal32 _X, _Decimal32 _Y);
   1379 
   1380 /*** floating multiply-add ***/
   1381 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fmad64.3m.htm */
   1382 _Decimal64 __cdecl fmad64(_Decimal64 _X, _Decimal64 y, _Decimal64 _Z);
   1383 _Decimal128 __cdecl fmad128(_Decimal128 _X, _Decimal128 y, _Decimal128 _Z);
   1384 _Decimal32 __cdecl fmad32(_Decimal32 _X, _Decimal32 y, _Decimal32 _Z);
   1385 
   1386 /*** exponent/significand ***/
   1387 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/logbd64.3m.htm */
   1388 _Decimal64 __cdecl logbd64(_Decimal64 _X);
   1389 _Decimal128 __cdecl logbd128(_Decimal128 _X);
   1390 _Decimal32 __cdecl logbd32(_Decimal32 _X);
   1391 
   1392 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/ilogbd64.3m.htm */
   1393 int __cdecl ilogbd64(_Decimal64 _X);
   1394 int __cdecl ilogbd128(_Decimal128 _X);
   1395 int __cdecl ilogbd32(_Decimal32 _X);
   1396 
   1397 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/frexpd64.3m.htm */
   1398 _Decimal64 __cdecl frexpd64(_Decimal64 _X, int *_Y);
   1399 _Decimal128 __cdecl frexpd128(_Decimal128 _X, int *_Y);
   1400 _Decimal32 __cdecl frexpd32(_Decimal32 _X, int *_Y);
   1401 
   1402 /*** quantum ***/
   1403 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/quantized64.3m.htm */
   1404 _Decimal64 __cdecl quantized64(_Decimal64 _X, _Decimal64 _Y);
   1405 _Decimal128 __cdecl quantized128(_Decimal128 _X, _Decimal128 _Y);
   1406 _Decimal32 __cdecl quantized32(_Decimal32 _X, _Decimal32 _Y);
   1407 
   1408 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/samequantumd64.3m.htm */
   1409 _Bool __cdecl samequantumd64(_Decimal64 _X, _Decimal64 _Y);
   1410 _Bool __cdecl samequantumd128(_Decimal128 _X, _Decimal128 _Y);
   1411 _Bool __cdecl samequantumd32(_Decimal32 _X, _Decimal32 _Y);
   1412 
   1413 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/quantexpd64.3m.htm */
   1414 int __cdecl quantexpd64(_Decimal64 _X);
   1415 int __cdecl quantexpd128(_Decimal128 _X);
   1416 int __cdecl quantexpd32(_Decimal32 _X);
   1417 
   1418 /*** scaling ***/
   1419 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/scalbnd64.3m.htm */
   1420 _Decimal64 __cdecl scalbnd64(_Decimal64 _X, int _Y);
   1421 _Decimal128 __cdecl scalbnd128(_Decimal128 _X, int _Y);
   1422 _Decimal32 __cdecl scalbnd32(_Decimal32 _X, int _Y);
   1423 
   1424 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/scalblnd64.3m.htm */
   1425 _Decimal64 __cdecl scalblnd64(_Decimal64 _X, long int _Y);
   1426 _Decimal128 __cdecl scalblnd128(_Decimal128 _X, long int _Y);
   1427 _Decimal32 __cdecl scalblnd32(_Decimal32 _X, long int _Y);
   1428 
   1429 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/ldexpd64.3m.htm */
   1430 _Decimal64 __cdecl ldexpd64(_Decimal64 _X, int _Y);
   1431 _Decimal128 __cdecl ldexpd128(_Decimal128 _X, int _Y);
   1432 _Decimal32 __cdecl ldexpd32(_Decimal32 _X, int _Y);
   1433 
   1434 /*** rounding to integral floating ***/
   1435 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/ceild64.3m.htm */
   1436 _Decimal64 __cdecl ceild64(_Decimal64 _X);
   1437 _Decimal128 __cdecl ceild128(_Decimal128 _X);
   1438 _Decimal32 __cdecl ceild32(_Decimal32 _X);
   1439 
   1440 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/floord64.3m.htm */
   1441 _Decimal64 __cdecl floord64(_Decimal64 _X);
   1442 _Decimal128 __cdecl floord128(_Decimal128 _X);
   1443 _Decimal32 __cdecl floord32(_Decimal32 _X);
   1444 
   1445 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/truncd64.3m.htm */
   1446 _Decimal64 __cdecl truncd64(_Decimal64 _X);
   1447 _Decimal128 __cdecl truncd128(_Decimal128 _X);
   1448 _Decimal32 __cdecl truncd32(_Decimal32 _X);
   1449 
   1450 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/roundd64.3m.htm */
   1451 _Decimal64 __cdecl roundd64(_Decimal64 _X);
   1452 _Decimal128 __cdecl roundd128(_Decimal128 _X);
   1453 _Decimal32 __cdecl roundd32(_Decimal32 _X);
   1454 
   1455 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/rintd64.3m.htm */
   1456 _Decimal64 __cdecl rintd64(_Decimal64 _X);
   1457 _Decimal128 __cdecl rintd128(_Decimal128 _X);
   1458 _Decimal32 __cdecl rintd32(_Decimal32 _X);
   1459 
   1460 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/nearbyintd64.3m.htm */
   1461 _Decimal64 __cdecl nearbyintd64(_Decimal64 _X);
   1462 _Decimal128 __cdecl nearbyintd128(_Decimal128 _X);
   1463 _Decimal32 __cdecl nearbyintd32(_Decimal32 _X);
   1464 
   1465 /*** rounding to integer ***/
   1466 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/lroundd64.3m.htm */
   1467 long int __cdecl lroundd64(_Decimal64 _X);
   1468 long int __cdecl lroundd128(_Decimal128 _X);
   1469 long int __cdecl lroundd32(_Decimal32 _X);
   1470 
   1471 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/llroundd64.3m.htm */
   1472 long long int __cdecl llroundd64(_Decimal64 _X);
   1473 long long int __cdecl llroundd128(_Decimal128 _X);
   1474 long long int __cdecl llroundd32(_Decimal32 _X);
   1475 
   1476 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/lrintd64.3m.htm */
   1477 long int __cdecl lrintd64(_Decimal64 _X);
   1478 long int __cdecl lrintd128(_Decimal128 _X);
   1479 long int __cdecl lrintd32(_Decimal32 _X);
   1480 
   1481 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/llrintd64.3m.htm */
   1482 long long int __cdecl llrintd64(_Decimal64 _X);
   1483 long long int __cdecl llrintd128(_Decimal128 _X);
   1484 long long int __cdecl llrintd32(_Decimal32 _X);
   1485 
   1486 /*** integral and fractional parts ***/
   1487 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/modfd64.3m.htm */
   1488 _Decimal64 __cdecl modfd64(_Decimal64 _X, _Decimal64 *_Y);
   1489 _Decimal128 __cdecl modfd128(_Decimal128 _X, _Decimal128 *_Y);
   1490 _Decimal32 __cdecl modfd32(_Decimal32 _X, _Decimal32 *_Y);
   1491 
   1492 /** remainder/mod ***/
   1493 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/remainderd64.3m.htm */
   1494 _Decimal64 __cdecl remainderd64(_Decimal64 _X, _Decimal64 _Y);
   1495 _Decimal128 __cdecl remainderd128(_Decimal128 _X, _Decimal128 _Y);
   1496 _Decimal32 __cdecl remainderd32(_Decimal32 _X, _Decimal32 _Y);
   1497 
   1498 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fmodd64.3m.htm */
   1499 _Decimal64 __cdecl fmodd64(_Decimal64 _X, _Decimal64 _Y);
   1500 _Decimal128 __cdecl fmodd128(_Decimal128 _X, _Decimal128 _Y);
   1501 _Decimal32 __cdecl fmodd32(_Decimal32 _X, _Decimal32 _Y);
   1502 
   1503 /*** error functions ***/
   1504 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/erfd64.3m.htm */
   1505 _Decimal64 __cdecl erfd64(_Decimal64 _X);
   1506 _Decimal128 __cdecl erfd128(_Decimal128 _X);
   1507 _Decimal32 __cdecl erfd32(_Decimal32 _X);
   1508 _Decimal64 __cdecl erfcd64(_Decimal64 _X);
   1509 _Decimal128 __cdecl erfcd128(_Decimal128 _X);
   1510 _Decimal32 __cdecl erfcd32(_Decimal32 _X);
   1511 
   1512 /*** gamma functions ***/
   1513 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/lgammad64.3m.htm */
   1514 _Decimal64 __cdecl lgammad64(_Decimal64 _X);
   1515 _Decimal128 __cdecl lgammad128(_Decimal128 _X);
   1516 _Decimal32 __cdecl lgammad32(_Decimal32 _X);
   1517 
   1518 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/tgammad64.3m.htm */
   1519 _Decimal64 __cdecl tgammad64(_Decimal64 _X);
   1520 _Decimal128 __cdecl tgammad128(_Decimal128 _X);
   1521 _Decimal32 __cdecl tgammad32(_Decimal32 _X);
   1522 
   1523 /*** next value ***/
   1524 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/nextafterd64.3m.htm */
   1525 _Decimal64 __cdecl nextafterd64(_Decimal64 _X, _Decimal64 _Y);
   1526 _Decimal128 __cdecl nextafterd128(_Decimal128 _X, _Decimal128 _Y);
   1527 _Decimal32 __cdecl nextafterd32(_Decimal32 _X, _Decimal32 _Y);
   1528 _Decimal64 __cdecl nexttowardd64(_Decimal64 _X, _Decimal128 _Y);
   1529 _Decimal128 __cdecl nexttowardd128(_Decimal128 _X, _Decimal128 _Y);
   1530 _Decimal32 __cdecl nexttowardd32(_Decimal32 _X, _Decimal128 _Y);
   1531 
   1532 /*** absolute value, copy sign ***/
   1533 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fabsd64.3m.htm */
   1534 _Decimal64 __cdecl fabsd64(_Decimal64 _X);
   1535 _Decimal128 __cdecl fabsd128(_Decimal128 _X);
   1536 _Decimal32 __cdecl fabsd32(_Decimal32 _X);
   1537 
   1538 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/copysignd64.3m.htm */
   1539 _Decimal64 __cdecl copysignd64(_Decimal64 _X, _Decimal64 _Y);
   1540 _Decimal128 __cdecl copysignd128(_Decimal128 _X, _Decimal128 _Y);
   1541 _Decimal32 __cdecl copysignd32(_Decimal32 _X, _Decimal32 _Y);
   1542 
   1543 /*** max, min, positive difference ***/
   1544 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fmaxd64.3m.htm */
   1545 _Decimal64 __cdecl fmaxd64(_Decimal64 _X, _Decimal64 y_Y);
   1546 _Decimal128 __cdecl fmaxd128(_Decimal128 _X, _Decimal128 _Y);
   1547 _Decimal32 __cdecl fmaxd32(_Decimal32 _X, _Decimal32 _Y);
   1548 
   1549 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fmind64.3m.htm */
   1550 _Decimal64 __cdecl fmind64(_Decimal64 _X, _Decimal64 _Y);
   1551 _Decimal128 __cdecl fmind128(_Decimal128 _X, _Decimal128 _Y);
   1552 _Decimal32 __cdecl fmind32(_Decimal32 _X, _Decimal32 _Y);
   1553 
   1554 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/fdimd64.3m.htm */
   1555 _Decimal64 __cdecl fdimd64(_Decimal64 _X, _Decimal64 _Y);
   1556 _Decimal128 __cdecl fdimd128(_Decimal128 _X, _Decimal128 _Y);
   1557 _Decimal32 __cdecl fdimd32(_Decimal32 _X, _Decimal32 _Y);
   1558 
   1559 /*** not-a-number ***/
   1560 /* http://h21007.www2.hp.com/portal/download/files/unprot/fp/manpages/nand64.3m.htm */
   1561 _Decimal64 __cdecl nand64(__UNUSED_PARAM(const char *_X));
   1562 _Decimal128 __cdecl nand128(__UNUSED_PARAM(const char *_X));
   1563 _Decimal32 __cdecl nand32(__UNUSED_PARAM(const char *_X));
   1564 
   1565 /*** classifiers ***/
   1566 int __cdecl isinfd64(_Decimal64 _X);
   1567 int __cdecl isinfd128(_Decimal128 _X);
   1568 int __cdecl isinfd32(_Decimal32 _X);
   1569 int __cdecl isnand64(_Decimal64 _X);
   1570 int __cdecl isnand128(_Decimal128 _X);
   1571 int __cdecl isnand32(_Decimal32 _X);
   1572 
   1573 #endif /* __STDC_WANT_DEC_FP__ */
   1574 
   1575 #ifdef __cplusplus
   1576 }
   1577 #endif
   1578 
   1579 #endif	/* Not RC_INVOKED */
   1580 
   1581 #pragma pack(pop)
   1582 
   1583 #endif /* End _MATH_H_ */
   1584 
   1585