summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-10-09 16:56:24 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-10-09 16:56:24 +0000
commit8cea8ca7a77a56cc601a818c13ede50f402cff3a (patch)
treecba6e858982dd07c4dec00025ad5ef527825946e /gcc/real.c
parenta2678ef6324e4120faa78d9da80331bbe2bfb726 (diff)
downloadgcc-8cea8ca7a77a56cc601a818c13ede50f402cff3a.tar.gz
(asctoeg): Allocate local buffer dynamically. Count
any lost significant digits before the decimal point. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5696 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/real.c b/gcc/real.c
index 57769b4c96d..b6b55a52ff7 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -4626,9 +4626,8 @@ asctoe (s, y)
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
asctoeg (ss, y, oprec)
char *ss;
@@ -4640,19 +4639,16 @@ asctoeg (ss, y, oprec)
int k, trail, c, rndsav;
EMULONG lexp;
unsigned EMUSHORT nsign, *p;
- char *sp, *s;
+ char *sp, *s, *lstr;
/* Copy the input string. */
+ lstr = (char *) alloca (strlen (ss) + 1);
s = ss;
while (*s == ' ') /* skip leading spaces */
++s;
sp = lstr;
- for (k = 0; k < 79; k++)
- {
- if ((*sp++ = *s++) == '\0')
- break;
- }
- *sp = '\0';
+ while ((*sp++ = *s++) == '\0')
+ ;
s = lstr;
rndsav = rndprc;
@@ -4713,7 +4709,11 @@ asctoeg (ss, y, oprec)
}
else
{
+ /* Mark any lost non-zero digit. */
lost |= k;
+ /* Count lost digits before the decimal point. */
+ if (decflg == 0)
+ nexp -= 1;
}
prec += 1;
goto donchr;