aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/longlong.h30
-rw-r--r--stdlib/strtod.c71
2 files changed, 49 insertions, 52 deletions
diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index 6d4f237..8bb6995 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -1,21 +1,21 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
+ Copyright (C) 1991, 92, 93, 94, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-This file is free software; you can redistribute it and/or modify
-it under the terms of the GNU Library General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at your
-option) any later version.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-This file is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-License for more details.
-
-You should have received a copy of the GNU Library General Public License
-along with this file; see the file COPYING.LIB. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* You have to define the following before including this file:
@@ -585,7 +585,7 @@ extern USItype __udiv_qrnnd ();
addx%.l %2,%0
| End inlined umul_ppmm" \
: "=&d" ((USItype)(xh)), "=&d" ((USItype)(xl)), \
- "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
+ "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
: "%2" ((USItype)(a)), "d" ((USItype)(b))); \
} while (0)
#define UMUL_TIME 100
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 5ddb956..1c13af7 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -46,6 +46,7 @@
mant = 0x8000000000000ULL; \
u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff; \
u.ieee.mantissa1 = (mant) & 0xffffffff; \
+ (flt) = u.d; \
} while (0)
#endif
/* End of configuration part. */
@@ -504,11 +505,9 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
{
int matched = 0;
/* Check for `INF' or `INFINITY'. */
- if (TOLOWER (c) == L_('i') && ((STRNCASECMP (cp, L_("nf"), 2) == 0
- && (matched = 2))
- || (STRNCASECMP (cp, L_("nfinity"), 7)
- == 0
- && (matched = 7))))
+ if (TOLOWER (c) == L_('i')
+ && ((STRNCASECMP (cp, L_("inf"), 3) == 0 && (matched = 3))
+ || (STRNCASECMP (cp, L_("infinity"), 8) == 0 && (matched = 8))))
{
/* Return +/- inifity. */
if (endptr != NULL)
@@ -517,47 +516,45 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
}
- if (TOLOWER (c) == L_('n') && STRNCASECMP (cp, L_("an"), 2) == 0)
+ if (TOLOWER (c) == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
{
+ /* Return NaN. */
FLOAT retval = NAN;
- /* Return NaN. */
- if (endptr != NULL)
- {
- cp += 2;
+ cp += 3;
- /* Match `(n-char-sequence-digit)'. */
- if (*cp == L_('('))
- {
- const STRING_TYPE *startp = cp;
- do
- ++cp;
- while ((*cp >= '0' && *cp <= '9')
- || (TOLOWER (*cp) >= 'a' && TOLOWER (*cp) <= 'z')
+ /* Match `(n-char-sequence-digit)'. */
+ if (*cp == L_('('))
+ {
+ const STRING_TYPE *startp = cp;
+ do
+ ++cp;
+ while ((*cp >= L_('0') && *cp <= L_('9'))
+ || (TOLOWER (*cp) >= L_('a') && TOLOWER (*cp) <= L_('z'))
|| *cp == L_('_'));
- if (*cp != L_(')'))
- /* The closing brace is missing. Only match the NAN
- part. */
- cp = startp;
- else
- {
- /* This is a system-dependent way to specify the
- bitmask used for the NaN. We expect it to be
- a number which is put in the mantissa of the
- number. */
- STRING_TYPE *endp;
- unsigned long long int mant;
-
- mant = STRTOULL (startp, &endp, 0);
- if (endp == cp)
- SET_MANTISSA (retval, mant);
- }
+ if (*cp != L_(')'))
+ /* The closing brace is missing. Only match the NAN
+ part. */
+ cp = startp;
+ else
+ {
+ /* This is a system-dependent way to specify the
+ bitmask used for the NaN. We expect it to be
+ a number which is put in the mantissa of the
+ number. */
+ STRING_TYPE *endp;
+ unsigned long long int mant;
+
+ mant = STRTOULL (startp + 1, &endp, 0);
+ if (endp == cp)
+ SET_MANTISSA (retval, mant);
}
-
- *endptr = (STRING_TYPE *) cp;
}
+ if (endptr != NULL)
+ *endptr = (STRING_TYPE *) cp;
+
return retval;
}