Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8a608c

Browse files
committed
Merged revisions 70678 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r70678 | mark.dickinson | 2009-03-29 15:37:51 +0100 (Sun, 29 Mar 2009) | 3 lines Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test with fabs(x) >= 1e50, and fix documentation. ........
1 parent 48e2478 commit c8a608c

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ that ``'\0'`` is the end of the string.
13221322
.. XXX Examples?
13231323
13241324
For safety reasons, floating point precisions are clipped to 50; ``%f``
1325-
conversions for numbers whose absolute value is over 1e25 are replaced by ``%g``
1325+
conversions for numbers whose absolute value is over 1e50 are replaced by ``%g``
13261326
conversions. [#]_ All other errors raise exceptions.
13271327

13281328
.. index::

Objects/stringlib/formatter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ format_float_internal(PyObject *value,
789789

790790
if (precision < 0)
791791
precision = 6;
792-
if (type == 'f' && (fabs(x) / 1e25) >= 1e25)
792+
if (type == 'f' && fabs(x) >= 1e50)
793793
type = 'g';
794794

795795
/* cast "type", because if we're in unicode we need to pass a

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8847,7 +8847,7 @@ formatfloat(Py_UNICODE *buf,
88478847
return -1;
88488848
if (prec < 0)
88498849
prec = 6;
8850-
if (type == 'f' && (fabs(x) / 1e25) >= 1e25)
8850+
if (type == 'f' && fabs(x) >= 1e50)
88518851
type = 'g';
88528852
/* Worst case length calc to ensure no buffer overrun:
88538853

0 commit comments

Comments
 (0)