comparison Python/pystrtod.c @ 53479:785ea299fe23

Merged revisions 71976 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r71976 | mark.dickinson | 2009-04-26 20:54:55 +0100 (Sun, 26 Apr 2009) | 2 lines Fix typo in function name ........
author Mark Dickinson <dickinsm@gmail.com>
date Sun, 26 Apr 2009 20:02:24 +0000
parents f76572108dd7
children de1d0f71e209
comparison
equal deleted inserted replaced
53475:7237730425fb 53479:785ea299fe23
295 #define MIN_EXPONENT_DIGITS 2 295 #define MIN_EXPONENT_DIGITS 2
296 296
297 /* Ensure that any exponent, if present, is at least MIN_EXPONENT_DIGITS 297 /* Ensure that any exponent, if present, is at least MIN_EXPONENT_DIGITS
298 in length. */ 298 in length. */
299 Py_LOCAL_INLINE(void) 299 Py_LOCAL_INLINE(void)
300 ensure_minumim_exponent_length(char* buffer, size_t buf_size) 300 ensure_minimum_exponent_length(char* buffer, size_t buf_size)
301 { 301 {
302 char *p = strpbrk(buffer, "eE"); 302 char *p = strpbrk(buffer, "eE");
303 if (p && (*(p + 1) == '-' || *(p + 1) == '+')) { 303 if (p && (*(p + 1) == '-' || *(p + 1) == '+')) {
304 char *start = p + 2; 304 char *start = p + 2;
305 int exponent_digit_cnt = 0; 305 int exponent_digit_cnt = 0;
496 /* If an exponent exists, ensure that the exponent is at least 496 /* If an exponent exists, ensure that the exponent is at least
497 MIN_EXPONENT_DIGITS digits, providing the buffer is large enough 497 MIN_EXPONENT_DIGITS digits, providing the buffer is large enough
498 for the extra zeros. Also, if there are more than 498 for the extra zeros. Also, if there are more than
499 MIN_EXPONENT_DIGITS, remove as many zeros as possible until we get 499 MIN_EXPONENT_DIGITS, remove as many zeros as possible until we get
500 back to MIN_EXPONENT_DIGITS */ 500 back to MIN_EXPONENT_DIGITS */
501 ensure_minumim_exponent_length(buffer, buf_size); 501 ensure_minimum_exponent_length(buffer, buf_size);
502 502
503 /* If format_char is 'Z', make sure we have at least one character 503 /* If format_char is 'Z', make sure we have at least one character
504 after the decimal point (and make sure we have a decimal point). */ 504 after the decimal point (and make sure we have a decimal point). */
505 if (format_char == 'Z') 505 if (format_char == 'Z')
506 ensure_decimal_point(buffer, buf_size); 506 ensure_decimal_point(buffer, buf_size);