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