[Python-checkins] r70678 - in python/trunk: Doc/library/stdtypes.rst Objects/stringlib/formatter.h Objects/stringobject.c Objects/unicodeobject.c
mark.dickinson
python-checkins at python.org
Sun Mar 29 16:37:52 CEST 2009
Author: mark.dickinson
Date: Sun Mar 29 16:37:51 2009
New Revision: 70678
Log:
Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test
with fabs(x) >= 1e50, and fix documentation.
Modified:
python/trunk/Doc/library/stdtypes.rst
python/trunk/Objects/stringlib/formatter.h
python/trunk/Objects/stringobject.c
python/trunk/Objects/unicodeobject.c
Modified: python/trunk/Doc/library/stdtypes.rst
==============================================================================
--- python/trunk/Doc/library/stdtypes.rst (original)
+++ python/trunk/Doc/library/stdtypes.rst Sun Mar 29 16:37:51 2009
@@ -1409,7 +1409,7 @@
.. 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::
Modified: python/trunk/Objects/stringlib/formatter.h
==============================================================================
--- python/trunk/Objects/stringlib/formatter.h (original)
+++ python/trunk/Objects/stringlib/formatter.h Sun Mar 29 16:37:51 2009
@@ -789,7 +789,7 @@
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
Modified: python/trunk/Objects/stringobject.c
==============================================================================
--- python/trunk/Objects/stringobject.c (original)
+++ python/trunk/Objects/stringobject.c Sun Mar 29 16:37:51 2009
@@ -4344,7 +4344,7 @@
}
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:
Modified: python/trunk/Objects/unicodeobject.c
==============================================================================
--- python/trunk/Objects/unicodeobject.c (original)
+++ python/trunk/Objects/unicodeobject.c Sun Mar 29 16:37:51 2009
@@ -8286,7 +8286,7 @@
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:
More information about the Python-checkins
mailing list