Changes in uspace/lib/softfloat/generic/add.c [9d58539:88d5c1e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softfloat/generic/add.c
r9d58539 r88d5c1e 39 39 #include <common.h> 40 40 41 /** 42 * Add two single-precision floats with the same signs. 41 /** Add two single-precision floats with the same sign. 43 42 * 44 43 * @param a First input operand. … … 46 45 * @return Result of addition. 47 46 */ 48 float32 add Float32(float32 a, float32 b)47 float32 add_float32(float32 a, float32 b) 49 48 { 50 49 int expdiff; … … 53 52 expdiff = a.parts.exp - b.parts.exp; 54 53 if (expdiff < 0) { 55 if (is Float32NaN(b)) {56 /* TODO: fix SigNaN */ 57 if (is Float32SigNaN(b)) {54 if (is_float32_nan(b)) { 55 /* TODO: fix SigNaN */ 56 if (is_float32_signan(b)) { 58 57 } 59 58 … … 71 70 expdiff *= -1; 72 71 } else { 73 if ((is Float32NaN(a)) || (isFloat32NaN(b))) {74 /* TODO: fix SigNaN */ 75 if (is Float32SigNaN(a) || isFloat32SigNaN(b)) {76 } 77 return (is Float32NaN(a) ? a : b);72 if ((is_float32_nan(a)) || (is_float32_nan(b))) { 73 /* TODO: fix SigNaN */ 74 if (is_float32_signan(a) || is_float32_signan(b)) { 75 } 76 return (is_float32_nan(a) ? a : b); 78 77 } 79 78 … … 150 149 } 151 150 152 /** 153 * Add two double-precision floats with the same signs. 151 /** Add two double-precision floats with the same sign. 154 152 * 155 153 * @param a First input operand. … … 157 155 * @return Result of addition. 158 156 */ 159 float64 add Float64(float64 a, float64 b)157 float64 add_float64(float64 a, float64 b) 160 158 { 161 159 int expdiff; … … 165 163 expdiff = ((int) a.parts.exp) - b.parts.exp; 166 164 if (expdiff < 0) { 167 if (is Float64NaN(b)) {168 /* TODO: fix SigNaN */ 169 if (is Float64SigNaN(b)) {170 } 171 172 return b; 173 } 174 175 /* b is infinity and a not */ 176 if (b.parts.exp == FLOAT64_MAX_EXPONENT) { 165 if (is_float64_nan(b)) { 166 /* TODO: fix SigNaN */ 167 if (is_float64_signan(b)) { 168 } 169 170 return b; 171 } 172 173 /* b is infinity and a not */ 174 if (b.parts.exp == FLOAT64_MAX_EXPONENT) { 177 175 return b; 178 176 } … … 184 182 expdiff *= -1; 185 183 } else { 186 if (is Float64NaN(a)) {187 /* TODO: fix SigNaN */ 188 if (is Float64SigNaN(a) || isFloat64SigNaN(b)) {184 if (is_float64_nan(a)) { 185 /* TODO: fix SigNaN */ 186 if (is_float64_signan(a) || is_float64_signan(b)) { 189 187 } 190 188 return a; … … 265 263 } 266 264 267 /** 268 * Add two quadruple-precision floats with the same signs. 265 /** Add two quadruple-precision floats with the same sign. 269 266 * 270 267 * @param a First input operand. … … 272 269 * @return Result of addition. 273 270 */ 274 float128 add Float128(float128 a, float128 b)271 float128 add_float128(float128 a, float128 b) 275 272 { 276 273 int expdiff; … … 280 277 expdiff = ((int) a.parts.exp) - b.parts.exp; 281 278 if (expdiff < 0) { 282 if (is Float128NaN(b)) {283 /* TODO: fix SigNaN */ 284 if (is Float128SigNaN(b)) {279 if (is_float128_nan(b)) { 280 /* TODO: fix SigNaN */ 281 if (is_float128_signan(b)) { 285 282 } 286 283 … … 301 298 expdiff *= -1; 302 299 } else { 303 if (is Float128NaN(a)) {304 /* TODO: fix SigNaN */ 305 if (is Float128SigNaN(a) || isFloat128SigNaN(b)) {300 if (is_float128_nan(a)) { 301 /* TODO: fix SigNaN */ 302 if (is_float128_signan(a) || is_float128_signan(b)) { 306 303 } 307 304 return a;
Note:
See TracChangeset
for help on using the changeset viewer.