Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test
with fabs(x) >= 1e50, and fix documentation.
This commit is contained in:
parent
310916212e
commit
2e648ecc7d
|
@ -1409,7 +1409,7 @@ that ``'\0'`` is the end of the string.
|
|||
.. XXX Examples?
|
||||
|
||||
For safety reasons, floating point precisions are clipped to 50; ``%f``
|
||||
conversions for numbers whose absolute value is over 1e25 are replaced by ``%g``
|
||||
conversions for numbers whose absolute value is over 1e50 are replaced by ``%g``
|
||||
conversions. [#]_ All other errors raise exceptions.
|
||||
|
||||
.. index::
|
||||
|
|
|
@ -789,7 +789,7 @@ format_float_internal(PyObject *value,
|
|||
|
||||
if (precision < 0)
|
||||
precision = 6;
|
||||
if (type == 'f' && (fabs(x) / 1e25) >= 1e25)
|
||||
if (type == 'f' && fabs(x) >= 1e50)
|
||||
type = 'g';
|
||||
|
||||
/* cast "type", because if we're in unicode we need to pass a
|
||||
|
|
|
@ -4344,7 +4344,7 @@ formatfloat(char *buf, size_t buflen, int flags,
|
|||
}
|
||||
if (prec < 0)
|
||||
prec = 6;
|
||||
if (type == 'f' && fabs(x)/1e25 >= 1e25)
|
||||
if (type == 'f' && fabs(x) >= 1e50)
|
||||
type = 'g';
|
||||
/* Worst case length calc to ensure no buffer overrun:
|
||||
|
||||
|
|
|
@ -8286,7 +8286,7 @@ formatfloat(Py_UNICODE *buf,
|
|||
return -1;
|
||||
if (prec < 0)
|
||||
prec = 6;
|
||||
if (type == 'f' && (fabs(x) / 1e25) >= 1e25)
|
||||
if (type == 'f' && fabs(x) >= 1e50)
|
||||
type = 'g';
|
||||
/* Worst case length calc to ensure no buffer overrun:
|
||||
|
||||
|
|
Loading…
Reference in New Issue