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 1147825..9643c09 100644 --- a/compat/strtod.c +++ b/compat/strtod.c @@ -1,4 +1,4 @@ -/* +/* * strtod.c -- * * Source code for the "strtod" library procedure. @@ -11,7 +11,6 @@ */ #include "tclInt.h" -#include <ctype.h> #ifndef TRUE #define TRUE 1 @@ -21,12 +20,12 @@ #define NULL 0 #endif -static int maxExponent = 511; /* Largest possible base 10 exponent. Any +static const 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 double powersOf10[] = { /* Table giving binary powers of 10. Entry */ +static const 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, @@ -61,7 +60,7 @@ static 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 @@ -76,8 +75,9 @@ strtod( * address here. */ { int sign, expSign = FALSE; - double fraction, dblExp, *d; - register CONST char *p; + double fraction, dblExp; + const double *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 += 1) { + for (d = powersOf10; exp != 0; exp >>= 1, ++d) { if (exp & 01) { dblExp *= *d; } |