mirror of
https://github.com/python/cpython.git
synced 2025-08-08 02:48:55 +00:00
Issue #7117, continued: Change round implementation to use the correctly-rounded
string <-> float conversions; this makes sure that the result of the round operation is correctly rounded, and hence displays nicely using the new float repr.
This commit is contained in:
parent
0516f81386
commit
bd15a06fd3
5 changed files with 389 additions and 20 deletions
|
@ -127,6 +127,13 @@ PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
|
|||
char *format_spec,
|
||||
Py_ssize_t format_spec_len);
|
||||
|
||||
/* Round a C double x to the closest multiple of 10**-ndigits. Returns a
|
||||
Python float on success, or NULL (with an appropriate exception set) on
|
||||
failure. Used in builtin_round in bltinmodule.c. */
|
||||
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue