Commit d73e9b8d by Richard Stallman

(asctoeg): Allocate local buffer dynamically.

(asctoeg): Allocate local buffer dynamically.  Count
any lost significant digits before the decimal point.

From-SVN: r5696
parent 0debc007
...@@ -4626,9 +4626,8 @@ asctoe (s, y) ...@@ -4626,9 +4626,8 @@ asctoe (s, y)
asctoeg (s, y, NBITS); asctoeg (s, y, NBITS);
} }
/* Space to make a copy of the input string: */
static char lstr[82];
/* ASCII to e type, with specified rounding precision = oprec. */
void void
asctoeg (ss, y, oprec) asctoeg (ss, y, oprec)
char *ss; char *ss;
...@@ -4640,19 +4639,16 @@ asctoeg (ss, y, oprec) ...@@ -4640,19 +4639,16 @@ asctoeg (ss, y, oprec)
int k, trail, c, rndsav; int k, trail, c, rndsav;
EMULONG lexp; EMULONG lexp;
unsigned EMUSHORT nsign, *p; unsigned EMUSHORT nsign, *p;
char *sp, *s; char *sp, *s, *lstr;
/* Copy the input string. */ /* Copy the input string. */
lstr = (char *) alloca (strlen (ss) + 1);
s = ss; s = ss;
while (*s == ' ') /* skip leading spaces */ while (*s == ' ') /* skip leading spaces */
++s; ++s;
sp = lstr; sp = lstr;
for (k = 0; k < 79; k++) while ((*sp++ = *s++) == '\0')
{ ;
if ((*sp++ = *s++) == '\0')
break;
}
*sp = '\0';
s = lstr; s = lstr;
rndsav = rndprc; rndsav = rndprc;
...@@ -4713,7 +4709,11 @@ asctoeg (ss, y, oprec) ...@@ -4713,7 +4709,11 @@ asctoeg (ss, y, oprec)
} }
else else
{ {
/* Mark any lost non-zero digit. */
lost |= k; lost |= k;
/* Count lost digits before the decimal point. */
if (decflg == 0)
nexp -= 1;
} }
prec += 1; prec += 1;
goto donchr; goto donchr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment