Rev 697 | Rev 734 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 697 | Rev 698 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | }; |
47 | }; |
48 | fb.parts.sign=0; |
48 | fb.parts.sign=0; |
49 | return subFloat32(fa,fb).f; |
49 | return subFloat32(fa,fb).f; |
50 | } |
50 | } |
51 | return addFloat32(fa,fb).f; |
51 | return addFloat32(fa,fb).f; |
52 | }; |
52 | } |
53 | 53 | ||
54 | float __subsf3(float a, float b) |
54 | float __subsf3(float a, float b) |
55 | { |
55 | { |
56 | float32 fa, fb; |
56 | float32 fa, fb; |
57 | fa.f=a; |
57 | fa.f=a; |
Line 59... | Line 59... | ||
59 | if (fa.parts.sign!=fb.parts.sign) { |
59 | if (fa.parts.sign!=fb.parts.sign) { |
60 | fb.parts.sign=!fb.parts.sign; |
60 | fb.parts.sign=!fb.parts.sign; |
61 | return addFloat32(fa,fb).f; |
61 | return addFloat32(fa,fb).f; |
62 | } |
62 | } |
63 | return subFloat32(fa,fb).f; |
63 | return subFloat32(fa,fb).f; |
64 | }; |
64 | } |
65 | 65 | ||
66 | float __mulsf3(float a, float b) |
66 | float __mulsf3(float a, float b) |
67 | { |
67 | { |
68 | float32 fa, fb; |
68 | float32 fa, fb; |
69 | fa.f=a; |
69 | fa.f=a; |
Line 75... | Line 75... | ||
75 | { |
75 | { |
76 | float32 fa, fb; |
76 | float32 fa, fb; |
77 | fa.f=a; |
77 | fa.f=a; |
78 | fb.f=b; |
78 | fb.f=b; |
79 | // return divFloat32(fa, fb).f; |
79 | // return divFloat32(fa, fb).f; |
80 | }; |
80 | } |
81 | 81 | ||
82 | float __negsf2(float a) |
82 | float __negsf2(float a) |
83 | { |
83 | { |
84 | float32 fa; |
84 | float32 fa; |
85 | fa.f=a; |
85 | fa.f=a; |
86 | fa.parts.sign=!fa.parts.sign; |
86 | fa.parts.sign=!fa.parts.sign; |
87 | return fa.f; |
87 | return fa.f; |
88 | }; |
88 | } |
89 | 89 | ||
90 | double __negdf2(double a) |
90 | double __negdf2(double a) |
91 | { |
91 | { |
92 | float64 fa; |
92 | float64 fa; |
93 | fa.d=a; |
93 | fa.d=a; |
94 | fa.parts.sign=!fa.parts.sign; |
94 | fa.parts.sign=!fa.parts.sign; |
95 | return fa.d; |
95 | return fa.d; |
96 | }; |
96 | } |
97 | 97 | ||
98 | /* Conversion functions */ |
98 | /* Conversion functions */ |
99 | 99 | ||
100 | double __extendsfdf2(float a) |
100 | double __extendsfdf2(float a) |
101 | { |
101 | { |
102 | float32 fa; |
102 | float32 fa; |
103 | fa.f = a; |
103 | fa.f = a; |
104 | return convertFloat32ToFloat64(fa).d; |
104 | return convertFloat32ToFloat64(fa).d; |
105 | }; |
105 | } |
106 | 106 | ||
107 | float __truncdfsf2(double a) |
107 | float __truncdfsf2(double a) |
108 | { |
108 | { |
109 | float64 da; |
109 | float64 da; |
110 | da.d = a; |
110 | da.d = a; |
111 | return convertFloat64ToFloat32(da).f; |
111 | return convertFloat64ToFloat32(da).f; |
112 | } |
112 | } |
- | 113 | ||
113 | /* Comparison functions */ |
114 | /* Comparison functions */ |
114 | 115 | ||
115 | /* a<b .. -1 |
116 | /* a<b .. -1 |
116 | * a=b .. 0 |
117 | * a=b .. 0 |
117 | * a>b .. 1 |
118 | * a>b .. 1 |
Line 141... | Line 142... | ||
141 | { |
142 | { |
142 | float32 fa,fb; |
143 | float32 fa,fb; |
143 | fa.f=a; |
144 | fa.f=a; |
144 | fb.f=b; |
145 | fb.f=b; |
145 | return ((isFloat32NaN(fa))||(isFloat32NaN(fb))); |
146 | return ((isFloat32NaN(fa))||(isFloat32NaN(fb))); |
146 | }; |
147 | } |
147 | 148 | ||
148 | /** |
149 | /** |
149 | * @return zero, if neither argument is a NaN and are equal |
150 | * @return zero, if neither argument is a NaN and are equal |
150 | * */ |
151 | * */ |
151 | int __eqsf2(float a, float b) |
152 | int __eqsf2(float a, float b) |
Line 156... | Line 157... | ||
156 | if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) { |
157 | if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) { |
157 | /* TODO: sigNaNs*/ |
158 | /* TODO: sigNaNs*/ |
158 | return 1; |
159 | return 1; |
159 | }; |
160 | }; |
160 | return isFloat32eq(fa,fb)-1; |
161 | return isFloat32eq(fa,fb)-1; |
161 | }; |
162 | } |
162 | 163 | ||
163 | /* strange behavior, but it was in gcc documentation */ |
164 | /* strange behavior, but it was in gcc documentation */ |
164 | int __nesf2(float a, float b) |
165 | int __nesf2(float a, float b) |
165 | { |
166 | { |
166 | return __eqsf2(a,b); |
167 | return __eqsf2(a,b); |
167 | }; |
168 | } |
168 | 169 | ||
169 | /* return value >= 0 if a>=b and neither is NaN */ |
170 | /* return value >= 0 if a>=b and neither is NaN */ |
170 | int __gesf2(float a, float b) |
171 | int __gesf2(float a, float b) |
171 | { |
172 | { |
172 | float32 fa,fb; |
173 | float32 fa,fb; |
Line 242... | Line 243... | ||
242 | return 0; |
243 | return 0; |
243 | } |
244 | } |
244 | 245 | ||
245 | /* Other functions */ |
246 | /* Other functions */ |
246 | 247 | ||
- | 248 | float __powisf2(float a, int b) |
|
- | 249 | { |
|
- | 250 | //TODO: |
|
- | 251 | } |
|
- | 252 | ||
- | 253 | float __mulsc3(float a, float b, float c, float d) |
|
- | 254 | { |
|
- | 255 | //TODO: |
|
- | 256 | } |
|
- | 257 | ||
- | 258 | float __divsc3(float a, float b, float c, float d) |
|
- | 259 | { |
|
- | 260 | //TODO: |
|
- | 261 | } |
|
- | 262 |