Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1 KiB

  1. /* xmath.h internal header for Microsoft C */
  2. #ifndef _XMATH
  3. #define _XMATH
  4. #include <wctype.h>
  5. #include <errno.h>
  6. #include <math.h>
  7. #include <stddef.h>
  8. #ifndef _YMATH
  9. #include <ymath.h>
  10. #endif
  11. _STD_BEGIN
  12. /* FLOAT PROPERTIES */
  13. #define _DBIAS 0x3fe
  14. #define _DOFF 4
  15. #define _FBIAS 0x7e
  16. #define _FOFF 7
  17. #define _FRND 1
  18. #define _D0 3 /* little-endian, small long doubles */
  19. #define _D1 2
  20. #define _D2 1
  21. #define _D3 0
  22. #define _DLONG 0
  23. #define _LBIAS 0x3fe
  24. #define _LOFF 4
  25. /* IEEE 754 double properties */
  26. #define _DFRAC ((1 << _DOFF) - 1)
  27. #define _DMASK (0x7fff & ~_DFRAC)
  28. #define _DMAX ((1 << (15 - _DOFF)) - 1)
  29. #define _DSIGN 0x8000
  30. #define DSIGN(x) (((unsigned short *)&(x))[_D0] & _DSIGN)
  31. #define HUGE_EXP (int)(_DMAX * 900L / 1000)
  32. #define HUGE_RAD 3.37e9 /* ~pi * 2^30 */
  33. #define SAFE_EXP (_DMAX >> 1)
  34. /* IEEE 754 float properties */
  35. #define _FFRAC ((1 << _FOFF) - 1)
  36. #define _FMASK (0x7fff & ~_FFRAC)
  37. #define _FMAX ((1 << (15 - _FOFF)) - 1)
  38. #define _FSIGN 0x8000
  39. #define FSIGN(x) (((unsigned short *)&(x))[_F0] & _FSIGN)
  40. #define FHUGE_EXP (int)(_FMAX * 900L / 1000)
  41. #define FHUGE_RAD 3.37e9 /* ~pi * 2^30 */
  42. #define FSAFE_EXP (_FMAX >> 1)
  43. #define _F0 1 /* little-endian order */
  44. #define _F1 0
  45. /* IEEE 754 long double properties */
  46. #define _LFRAC (-1)
  47. #define _LMASK 0x7fff
  48. #define _LMAX 0x7fff
  49. #define _LSIGN 0x8000
  50. #define LSIGN(x) (((unsigned short *)&(x))[_L0] & _LSIGN)
  51. #define LHUGE_EXP (int)(_LMAX * 900L / 1000)
  52. #define LHUGE_RAD 3.37e9 /* ~pi * 2^30 */
  53. #define LSAFE_EXP (_LMAX >> 1)
  54. #define _L0 4 /* little-endian order */
  55. #define _L1 3
  56. #define _L2 2
  57. #define _L3 1
  58. #define _L4 0
  59. /* return values for testing functions */
  60. #define FINITE _FINITE
  61. #define INF _INFCODE
  62. #define NAN _NANCODE
  63. _C_LIB_DECL
  64. /* double declarations */
  65. _CRTIMP double _Atan(double, unsigned short);
  66. _CRTIMP short _Dint(double *, short);
  67. _CRTIMP short _Dnorm(unsigned short *);
  68. _CRTIMP short _Dscale(double *, long);
  69. _CRTIMP double _Dtento(double, long);
  70. _CRTIMP short _Dunscale(short *, double *);
  71. _CRTIMP double _Poly(double, const double *, int);
  72. extern _CRTIMP const _Dconst _Eps, _Rteps;
  73. extern _CRTIMP const double _Xbig;
  74. /* float declarations */
  75. _CRTIMP float _FAtan(float, unsigned short);
  76. _CRTIMP short _FDint(float *, short);
  77. _CRTIMP short _FDnorm(unsigned short *);
  78. _CRTIMP short _FDscale(float *, long);
  79. _CRTIMP float _FDtento(float, long);
  80. _CRTIMP short _FDunscale(short *, float *);
  81. _CRTIMP float _FPoly(float, const float *, int);
  82. extern _CRTIMP const _Dconst _FEps, _FRteps;
  83. extern _CRTIMP const float _FXbig;
  84. /* long double functions */
  85. _CRTIMP long double _LAtan(long double, unsigned short);
  86. _CRTIMP short _LDint(long double *, short);
  87. _CRTIMP short _LDnorm(unsigned short *);
  88. _CRTIMP short _LDscale(long double *, long);
  89. _CRTIMP long double _LDtento(long double, long);
  90. _CRTIMP short _LDunscale(short *, long double *);
  91. _CRTIMP long double _LPoly(long double, const long double *, int);
  92. extern _CRTIMP const _Dconst _LEps, _LRteps;
  93. extern _CRTIMP const long double _LXbig;
  94. _END_C_LIB_DECL
  95. _STD_END
  96. #endif /* _XMATH */
  97. /*
  98. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  99. * Consult your license regarding permissions and restrictions.
  100. */