mirror of
https://github.com/python/cpython.git
synced 2025-09-16 21:56:14 +00:00
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.
This commit is contained in:
parent
929ab93489
commit
a985a3aee4
9 changed files with 110 additions and 27 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue