summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2009-05-05 14:04:18 +0000
committerEric Smith <eric@trueblade.com>2009-05-05 14:04:18 +0000
commit63376228a3f2d3ac4a21a10c0653c3b984c2d686 (patch)
treee781a7c8a1abe5c032d83bbc2948c4bd34d4d77e /Include
parent86a05ecdb5eb91cf174e9b3c8adf0187e868aa68 (diff)
downloadcpython-git-63376228a3f2d3ac4a21a10c0653c3b984c2d686.tar.gz
Issue #5920: Changed format.__float__ and complex.__float__ to use a precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson.
Diffstat (limited to 'Include')
-rw-r--r--Include/floatobject.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 364b913b47..5b8d1a1b16 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -21,6 +21,12 @@ PyAPI_DATA(PyTypeObject) PyFloat_Type;
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type)
+/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases,
+ the rounding noise created by various operations is suppressed, while
+ giving plenty of precision for practical use. */
+
+#define PyFloat_STR_PRECISION 12
+
#ifdef Py_NAN
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
#endif