- if (isdigit (*s))
- {
- got_digit = 1;
-
- /* Make sure that multiplication by 10 will not overflow. */
- if (num > DBL_MAX * 0.1)
- /* The value of the digit doesn't matter, since we have already
- gotten as many digits as can be represented in a `double'.
- This doesn't necessarily mean the result will overflow.
- The exponent may reduce it to within range.
-
- We just need to record that there was another
- digit so that we can multiply by 10 later. */
- ++exponent;
- else
- num = (num * 10.0) + (*s - '0');
-
- /* Keep track of the number of digits after the decimal point.
- If we just divided by 10 here, we would lose precision. */
- if (got_dot)
- --exponent;
- }
- else if (!got_dot && (wchar_t) *s == decimal)
- /* Record that we have found the decimal point. */
- got_dot = 1;
+ int digit;
+ if (c_isdigit (*s))
+ digit = *s - '0';
+ else if (base == 16 && c_isxdigit (*s))
+ digit = c_tolower (*s) - ('a' - 10);
+ else if (! got_dot && *s == '.')
+ {
+ /* Record that we have found the decimal point. */
+ got_dot = true;
+ continue;
+ }