summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/dtoa.c34
-rw-r--r--Python/pystrtod.c41
2 files changed, 1 insertions, 74 deletions
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 6ea60ac..c5e343b 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -273,11 +273,6 @@ typedef union { double d; ULong L[2]; } U;
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
#define Big1 0xffffffff
-/* Standard NaN used by _Py_dg_stdnan. */
-
-#define NAN_WORD0 0x7ff80000
-#define NAN_WORD1 0
-
/* Bits of the representation of positive infinity. */
#define POSINF_WORD0 0x7ff00000
@@ -1399,35 +1394,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc)
return 0;
}
-/* Return a 'standard' NaN value.
-
- There are exactly two quiet NaNs that don't arise by 'quieting' signaling
- NaNs (see IEEE 754-2008, section 6.2.1). If sign == 0, return the one whose
- sign bit is cleared. Otherwise, return the one whose sign bit is set.
-*/
-
-double
-_Py_dg_stdnan(int sign)
-{
- U rv;
- word0(&rv) = NAN_WORD0;
- word1(&rv) = NAN_WORD1;
- if (sign)
- word0(&rv) |= Sign_bit;
- return dval(&rv);
-}
-
-/* Return positive or negative infinity, according to the given sign (0 for
- * positive infinity, 1 for negative infinity). */
-
-double
-_Py_dg_infinity(int sign)
-{
- U rv;
- word0(&rv) = POSINF_WORD0;
- word1(&rv) = POSINF_WORD1;
- return sign ? -dval(&rv) : dval(&rv);
-}
double
_Py_dg_strtod(const char *s00, char **se)
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index d77b846..9bb060e 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -23,44 +23,6 @@ case_insensitive_match(const char *s, const char *t)
return the NaN or Infinity as a double and set *endptr to point just beyond
the successfully parsed portion of the string. On failure, return -1.0 and
set *endptr to point to the start of the string. */
-
-#if _PY_SHORT_FLOAT_REPR == 1
-
-double
-_Py_parse_inf_or_nan(const char *p, char **endptr)
-{
- double retval;
- const char *s;
- int negate = 0;
-
- s = p;
- if (*s == '-') {
- negate = 1;
- s++;
- }
- else if (*s == '+') {
- s++;
- }
- if (case_insensitive_match(s, "inf")) {
- s += 3;
- if (case_insensitive_match(s, "inity"))
- s += 5;
- retval = _Py_dg_infinity(negate);
- }
- else if (case_insensitive_match(s, "nan")) {
- s += 3;
- retval = _Py_dg_stdnan(negate);
- }
- else {
- s = p;
- retval = -1.0;
- }
- *endptr = (char *)s;
- return retval;
-}
-
-#else
-
double
_Py_parse_inf_or_nan(const char *p, char **endptr)
{
@@ -84,7 +46,7 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
}
else if (case_insensitive_match(s, "nan")) {
s += 3;
- retval = negate ? -Py_NAN : Py_NAN;
+ retval = negate ? -fabs(Py_NAN) : fabs(Py_NAN);
}
else {
s = p;
@@ -94,7 +56,6 @@ _Py_parse_inf_or_nan(const char *p, char **endptr)
return retval;
}
-#endif
/**
* _PyOS_ascii_strtod: