Changes in uspace/lib/posix/stdlib/strtold.c [4cf8ca6:ec18957a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdlib/strtold.c
r4cf8ca6 rec18957a 30 30 * @{ 31 31 */ 32 /** @file Backend for floating point conversions.32 /** @file 33 33 */ 34 34 … … 55 55 #endif 56 56 57 // TODO: clean up 57 // TODO: clean up, documentation 58 58 59 59 // FIXME: ensure it builds and works on all platforms … … 116 116 }; 117 117 118 /**119 * Decides whether the argument is still in range representable by120 * long double or not.121 *122 * @param num Floating point number to be checked.123 * @return True if the argument is out of range, false otherwise.124 */125 118 static inline bool out_of_range(long double num) 126 119 { … … 134 127 * @param base Number to be multiplied. 135 128 * @param exponent Base 5 exponent. 136 * @return base multiplied by 5**exponent .129 * @return base multiplied by 5**exponent 137 130 */ 138 131 static long double mul_pow5(long double base, int exponent) … … 180 173 * @param base Number to be multiplied. 181 174 * @param exponent Base 2 exponent. 182 * @return base multiplied by 2**exponent .175 * @return base multiplied by 2**exponent 183 176 */ 184 177 static long double mul_pow2(long double base, int exponent) … … 219 212 } 220 213 221 /** 222 * Convert decimal string representation of the floating point number. 223 * Function expects the string pointer to be already pointed at the first 224 * digit (i.e. leading optional sign was already consumed by the caller). 225 * 226 * @param sptr Pointer to the storage of the string pointer. Upon successful 227 * conversion, the string pointer is updated to point to the first 228 * unrecognized character. 229 * @return An approximate representation of the input floating-point number. 230 */ 214 231 215 static long double parse_decimal(const char **sptr) 232 216 { … … 331 315 } 332 316 333 /**334 * Derive a hexadecimal digit from its character representation.335 *336 * @param ch Character representation of the hexadecimal digit.337 * @return Digit value represented by an integer.338 */339 317 static inline int hex_value(char ch) 340 318 { … … 347 325 348 326 /** 349 * Get the count of leading zero bits up to the maximum of 3 zero bits.350 *351 327 * @param val Integer value. 352 328 * @return How many leading zero bits there are. (Maximum is 3) … … 363 339 } 364 340 365 /**366 * Convert hexadecimal string representation of the floating point number.367 * Function expects the string pointer to be already pointed at the first368 * digit (i.e. leading optional sign and 0x prefix were already consumed369 * by the caller).370 *371 * @param sptr Pointer to the storage of the string pointer. Upon successful372 * conversion, the string pointer is updated to point to the first373 * unrecognized character.374 * @return Representation of the input floating-point number.375 */376 341 static long double parse_hexadecimal(const char **sptr) 377 342 { … … 513 478 * @param nptr Input string. 514 479 * @param endptr If non-NULL, *endptr is set to the position of the first 515 * 480 * unrecognized character. 516 481 * @return An approximate representation of the input floating-point number. 517 482 */ … … 547 512 548 513 if (endptr != NULL) { 549 *endptr = (char *) nptr;550 } 551 errno = E INVAL;552 return 0;514 *endptr = (char *) &nptr[i + 3]; 515 } 516 errno = ERANGE; 517 return negative ? -0.0l : +0.0l; 553 518 } 554 519 … … 602 567 /** @} 603 568 */ 569
Note:
See TracChangeset
for help on using the changeset viewer.