math.h 3.5 KB

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