diff options
Diffstat (limited to 'compat/strtod.c')
-rw-r--r-- | compat/strtod.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compat/strtod.c b/compat/strtod.c index 9643c09..1147825 100644 --- a/compat/strtod.c +++ b/compat/strtod.c @@ -1,4 +1,4 @@ -/* +/* * strtod.c -- * * Source code for the "strtod" library procedure. @@ -11,6 +11,7 @@ */ #include "tclInt.h" +#include <ctype.h> #ifndef TRUE #define TRUE 1 @@ -20,12 +21,12 @@ #define NULL 0 #endif -static const int maxExponent = 511; /* Largest possible base 10 exponent. Any +static int maxExponent = 511; /* Largest possible base 10 exponent. Any * exponent larger than this will already * produce underflow or overflow, so there's * no need to worry about additional digits. */ -static const double powersOf10[] = { /* Table giving binary powers of 10. Entry */ +static double powersOf10[] = { /* Table giving binary powers of 10. Entry */ 10., /* is 10^2^i. Used to convert decimal */ 100., /* exponents into floating-point numbers. */ 1.0e4, @@ -60,7 +61,7 @@ static const double powersOf10[] = { /* Table giving binary powers of 10. Entry double strtod( - const char *string, /* A decimal ASCII floating-point number, + CONST char *string, /* A decimal ASCII floating-point number, * optionally preceded by white space. Must * have form "-I.FE-X", where I is the integer * part of the mantissa, F is the fractional @@ -75,9 +76,8 @@ strtod( * address here. */ { int sign, expSign = FALSE; - double fraction, dblExp; - const double *d; - register const char *p; + double fraction, dblExp, *d; + register CONST char *p; register int c; int exp = 0; /* Exponent read from "EX" field. */ int fracExp = 0; /* Exponent that derives from the fractional @@ -92,7 +92,7 @@ strtod( int mantSize; /* Number of digits in mantissa. */ int decPt; /* Number of mantissa digits BEFORE decimal * point. */ - const char *pExp; /* Temporarily holds location of exponent in + CONST char *pExp; /* Temporarily holds location of exponent in * string. */ /* @@ -137,7 +137,7 @@ strtod( * has more than 18 digits, ignore the extras, since they can't affect the * value anyway. */ - + pExp = p; p -= mantSize; if (decPt < 0) { @@ -217,7 +217,7 @@ strtod( * by processing the exponent one bit at a time to combine many powers of * 2 of 10. Then combine the exponent with the fraction. */ - + if (exp < 0) { expSign = TRUE; exp = -exp; @@ -229,7 +229,7 @@ strtod( errno = ERANGE; } dblExp = 1.0; - for (d = powersOf10; exp != 0; exp >>= 1, ++d) { + for (d = powersOf10; exp != 0; exp >>= 1, d += 1) { if (exp & 01) { dblExp *= *d; } |