1 #ifndef __TIMATH
2 #define __TIMATH
3 
4 #include <default.h>
5 
6 /* Begin Auto-Generated Part */
7 #define FIVE (5.)
8 #define FOUR (4.)
9 #define HALF_PI (1.570796326794897)
10 #define HALF (0.5)
11 #define MINUS_ONE (-1.)
12 #define NAN (0./0.)
13 #define NEGATIVE_INF (1/NEGATIVE_ZERO)
14 #define NEGATIVE_ZERO (-POSITIVE_ZERO)
15 #define ONE (1.)
16 #define PI (3.141592653589793)
17 #define POSITIVE_INF (1/POSITIVE_ZERO)
18 #define POSITIVE_ZERO (1.e-8192*1.e-8192)
19 #define TEN (10.)
20 #define THREE (3.)
21 #define TWO (2.)
22 #define UNSIGNED_INF (1/UNSIGNED_ZERO)
23 #define UNSIGNED_ZERO (0.)
24 #define ZERO (0.)
25 #ifndef __HAVE_Bool
26 #define __HAVE_Bool
27 enum Bool{FALSE,TRUE};
28 #endif
29 #ifndef __HAVE_bcd
30 #define __HAVE_bcd
31 typedef struct{unsigned short exponent;unsigned long long mantissa;}bcd __attribute__((__may_alias__));
32 #endif
33 #ifndef __HAVE_ti_float
34 #define __HAVE_ti_float
35 typedef float ti_float;
36 #endif
37 #define abs(x) ({typeof(x) __x = (x); __x >= 0 ? __x : -__x;})
38 #define acos(x) _tios_float_1(F5,x,float)
39 #define acosh(x) _tios_float_1(288,x,float)
40 #define asin(x) _tios_float_1(F6,x,float)
41 #define asinh(x) _tios_float_1(287,x,float)
42 #define atan2(x,y) _tios_float_2(F8,x,y,float,float)
43 #define atan(x) _tios_float_1(F7,x,float)
44 #define atanh(x) _tios_float_1(289,x,float)
45 #define bcd_to_float(a) ({bcd __a=(a);*(float*)&__a;})
46 #define bcd_var(a) (*(bcd*)&(a))
47 #define bcdadd(x,y) ({bcd __x=(x),__y=(y);float __z=fadd(*(float*)&__x,*(float*)&__y);*(bcd*)&__z;})
48 #define bcdbcd(x) ({float __x=flt(x);*(bcd*)&__x;})
49 #define bcdcmp(x,y) ({bcd __x=(x),__y=(y);fcmp(*(float*)&__x,*(float*)&__y);})
50 #define bcddiv(x,y) ({bcd __x=(x),__y=(y);float __z=fdiv(*(float*)&__x,*(float*)&__y);*(bcd*)&__z;})
51 #define bcdlong(x) ({bcd __x=(x);trunc(*(float*)&__x);})
52 #define bcdmul(x,y) ({bcd __x=(x),__y=(y);float __z=fmul(*(float*)&__x,*(float*)&__y);*(bcd*)&__z;})
53 #define bcdneg(x) ({bcd __x=(x);float __y=fneg(*(float*)&__x);*(bcd*)&__y;})
54 #define bcdsub(x,y) ({bcd __x=(x),__y=(y);float __z=fsub(*(float*)&__x,*(float*)&__y);*(bcd*)&__z;})
55 #define cacos _rom_call(void,(float,float,float*,float*),13A)
56 #define cacosh _rom_call(void,(float,float,float*,float*),13D)
57 #define casin _rom_call(void,(float,float,float*,float*),13B)
58 #define casinh _rom_call(void,(float,float,float*,float*),13E)
59 #define catan _rom_call(void,(float,float,float*,float*),13C)
60 #define catanh _rom_call(void,(float,float,float*,float*),13F)
61 #define ccos _rom_call(void,(float,float,float*,float*),140)
62 #define ccosh _rom_call(void,(float,float,float*,float*),143)
63 #define ceil(x) _tios_float_1(105,x,float)
64 #define cexp _rom_call(void,(float,float,float*,float*),149)
65 #define cln _rom_call(void,(float,float,float*,float*),147)
66 #define clog10 _rom_call(void,(float,float,float*,float*),148)
67 #define cos(x) _tios_float_1(F9,x,float)
68 #define cosh(x) _tios_float_1(FC,x,float)
69 #define csin _rom_call(void,(float,float,float*,float*),141)
70 #define csinh _rom_call(void,(float,float,float*,float*),144)
71 #define csqrt _rom_call(void,(float,float,float*,float*),146)
72 #define ctan _rom_call(void,(float,float,float*,float*),142)
73 #define ctanh _rom_call(void,(float,float,float*,float*),145)
74 #define exp(x) _tios_float_1(FF,x,float)
75 #define fabs(x) _tios_float_1(106,x,float)
76 #define fadd(x,y) _tios_float_2(B6,x,y,float,float)
77 #define fcmp _rom_call(long,(float,float),BB)
78 #define fdiv(x,y) _tios_float_2(B9,x,y,float,float)
79 #define FEXP_NEG(x,y) (*(float*)&(bcd){0xC000+y,0x##x##LL<<4*(17-sizeof(#x))})
80 #define FEXP(x,y) (*(float*)&(bcd){0x4000+y,0x##x##LL<<4*(17-sizeof(#x))})
81 #define float_to_bcd(a) ({float __a=(a);*(bcd*)&__a;})
82 #define floor(x) _tios_float_1(107,x,float)
83 #define FLT_NEG(x,y...) ((sizeof(#y)==1)?-x##.0:-x##.##y)
84 #define flt(x) _tios_float_1(BD,x,long)
85 #define FLT(x,y...) ((sizeof(#y)==1)?x##.0:x##.##y)
86 #define fmod(x,y) _tios_float_2(108,x,y,float,float)
87 #define fmul(x,y) _tios_float_2(B8,x,y,float,float)
88 #define fneg(x) _tios_float_1(BA,x,float)
89 #define fpisanint _rom_call(short,(unsigned long long*,short),172)
90 #define fpisodd _rom_call(short,(const unsigned long long*,short),173)
91 #define fsub(x,y) _tios_float_2(B7,x,y,float,float)
92 #define hypot(x,y) ({float __x=(x),__y=(y);sqrt(fadd(fmul((__x),(__x)),fmul((__y),(__y))));})
93 #define init_float() ((void)0)
94 #define itrig _rom_call(void,(short,short,float*,float*),28A)
95 #ifndef __HAVE_labs
96 #define __HAVE_labs
97 long labs(long)__ATTR_GCC__;
98 #endif
99 #define ldexp10(x,e) ({float __f=(x);((bcd*)&__f)->exponent+=(e);__f;})
100 #define log(x) _tios_float_1(100,x,float)
101 #define log10(x) _tios_float_1(101,x,float)
102 #define modf(x,y) _tios_float_2(102,x,y,float,float*)
103 #define pow(x,y) _tios_float_2(103,x,y,float,float)
104 #define round12_err(x,y) _tios_float_2(227,x,y,float,short)
105 #define round12(x) _tios_float_1(174,x,float)
106 #define round14(x) _tios_float_1(175,x,float)
107 #define sin(x) _tios_float_1(FA,x,float)
108 #define sincos _rom_call(void,(float,short,float*,float*),286)
109 #define sinh(x) _tios_float_1(FD,x,float)
110 #define sqrt(x) _tios_float_1(104,x,float)
111 #define tan(x) _tios_float_1(FB,x,float)
112 #define tanh(x) _tios_float_1(FE,x,float)
113 #define trig _rom_call(void,(short,short,const float*,float*,float*,float*),28B)
114 #define trunc _rom_call(long,(float),BC)
115 #if MIN_AMS>=101
116 #ifndef __HAVE_atof
117 #define __HAVE_atof
118 extern float atof(const char*)__ATTR_LIB_ASM__;
119 #endif
120 #define float_class _rom_call(short,(float),2FA)
121 #define frexp10(x,y) _tios_float_2(2FB,x,y,float,__pshort)
122 #define is_float_infinity _rom_call(short,(float),2FF)
123 #define is_float_negative_zero _rom_call(short,(float),300)
124 #define is_float_positive_zero _rom_call(short,(float),301)
125 #define is_float_signed_infinity _rom_call(short,(float),302)
126 #define is_float_transfinite _rom_call(short,(float),303)
127 #define is_float_unsigned_inf_or_nan _rom_call(short,(float),304)
128 #define is_float_unsigned_zero _rom_call(short,(float),305)
129 #define is_inf _rom_call(short,(float),2FF)
130 #define is_nan _rom_call(short,(float),306)
131 #define is_nzero _rom_call(short,(float),300)
132 #define is_pzero _rom_call(short,(float),301)
133 #define is_sinf _rom_call(short,(float),302)
134 #define is_transfinite _rom_call(short,(float),303)
135 #define is_uinf_or_nan _rom_call(short,(float),304)
136 #define is_uzero _rom_call(short,(float),305)
137 #endif
138 /* End Auto-Generated Part */
139 
140 #endif
141