diff options
-rw-r--r-- | Doc/library/stdtypes.rst | 2 | ||||
-rw-r--r-- | Objects/stringlib/formatter.h | 2 | ||||
-rw-r--r-- | Objects/stringobject.c | 2 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index f3ff505b0b..2e540394ea 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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:: diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index 2e3e5a6758..86235a64b5 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -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 diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 8f82f4f48e..3b5d331bed 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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: diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 107ed29565..4ce9bed189 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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: |