math.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef __MATH
  2. #define __MATH
  3. #ifndef KERNEL_NEW
  4. #include <default.h>
  5. #endif
  6. /* Begin Auto-Generated Part */
  7. #define HALF_PI (1.570796326794897)
  8. #define NAN (0./0.)
  9. #define NEGATIVE_INF (1/NEGATIVE_ZERO)
  10. #define NEGATIVE_ZERO (-POSITIVE_ZERO)
  11. #define PI (3.141592653589793)
  12. #define POSITIVE_INF (1/POSITIVE_ZERO)
  13. #define POSITIVE_ZERO (1.e-8192*1.e-8192)
  14. #define UNSIGNED_INF (1/UNSIGNED_ZERO)
  15. #define UNSIGNED_ZERO (0.)
  16. #define ZERO (0.)
  17. #ifndef __HAVE_bcd
  18. #define __HAVE_bcd
  19. typedef struct{unsigned short exponent;unsigned long long mantissa;}bcd __attribute__((__may_alias__));
  20. #endif
  21. #ifndef __HAVE_Bool
  22. #define __HAVE_Bool
  23. enum Bool{FALSE,TRUE};
  24. #endif
  25. #define abs(x) ({typeof(x) __x = (x); __x >= 0 ? __x : -__x;})
  26. #define acos(x) _tios_float_1(F5,x,float)
  27. #define acosh(x) _tios_float_1(288,x,float)
  28. #define asin(x) _tios_float_1(F6,x,float)
  29. #define asinh(x) _tios_float_1(287,x,float)
  30. #define atan2(x,y) _tios_float_2(F8,x,y,float,float)
  31. #define atan(x) _tios_float_1(F7,x,float)
  32. #define atanh(x) _tios_float_1(289,x,float)
  33. #define cacos _rom_call(void,(float,float,float*,float*),13A)
  34. #define cacosh _rom_call(void,(float,float,float*,float*),13D)
  35. #define casin _rom_call(void,(float,float,float*,float*),13B)
  36. #define casinh _rom_call(void,(float,float,float*,float*),13E)
  37. #define catan _rom_call(void,(float,float,float*,float*),13C)
  38. #define catanh _rom_call(void,(float,float,float*,float*),13F)
  39. #define ccos _rom_call(void,(float,float,float*,float*),140)
  40. #define ccosh _rom_call(void,(float,float,float*,float*),143)
  41. #define ceil(x) _tios_float_1(105,x,float)
  42. #define cexp _rom_call(void,(float,float,float*,float*),149)
  43. #define cln _rom_call(void,(float,float,float*,float*),147)
  44. #define clog10 _rom_call(void,(float,float,float*,float*),148)
  45. #define cos(x) _tios_float_1(F9,x,float)
  46. #define cosh(x) _tios_float_1(FC,x,float)
  47. #define csin _rom_call(void,(float,float,float*,float*),141)
  48. #define csinh _rom_call(void,(float,float,float*,float*),144)
  49. #define csqrt _rom_call(void,(float,float,float*,float*),146)
  50. #define ctan _rom_call(void,(float,float,float*,float*),142)
  51. #define ctanh _rom_call(void,(float,float,float*,float*),145)
  52. #define exp(x) _tios_float_1(FF,x,float)
  53. #define fabs(x) _tios_float_1(106,x,float)
  54. #define floor(x) _tios_float_1(107,x,float)
  55. #define fmod(x,y) _tios_float_2(108,x,y,float,float)
  56. #define hypot(x,y) ({float __x=(x),__y=(y);sqrt(fadd(fmul((__x),(__x)),fmul((__y),(__y))));})
  57. #ifndef __HAVE_labs
  58. #define __HAVE_labs
  59. long labs(long)__ATTR_GCC__;
  60. #endif
  61. #define ldexp10(x,e) ({float __f=(x);((bcd*)&__f)->exponent+=(e);__f;})
  62. #define log(x) _tios_float_1(100,x,float)
  63. #define log10(x) _tios_float_1(101,x,float)
  64. #define modf(x,y) _tios_float_2(102,x,y,float,float*)
  65. #define pow(x,y) _tios_float_2(103,x,y,float,float)
  66. #define sin(x) _tios_float_1(FA,x,float)
  67. #define sinh(x) _tios_float_1(FD,x,float)
  68. #define sqrt(x) _tios_float_1(104,x,float)
  69. #define tan(x) _tios_float_1(FB,x,float)
  70. #define tanh(x) _tios_float_1(FE,x,float)
  71. #if MIN_AMS>=101
  72. #ifndef __HAVE_atof
  73. #define __HAVE_atof
  74. extern float atof(const char*)__ATTR_LIB_ASM__;
  75. #endif
  76. #define frexp10(x,y) _tios_float_2(2FB,x,y,float,__pshort)
  77. #define is_inf _rom_call(short,(float),2FF)
  78. #define is_nan _rom_call(short,(float),306)
  79. #define is_nzero _rom_call(short,(float),300)
  80. #define is_pzero _rom_call(short,(float),301)
  81. #define is_sinf _rom_call(short,(float),302)
  82. #define is_transfinite _rom_call(short,(float),303)
  83. #define is_uinf_or_nan _rom_call(short,(float),304)
  84. #define is_uzero _rom_call(short,(float),305)
  85. #endif
  86. /* End Auto-Generated Part */
  87. #endif