summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-01-27 21:17:04 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-01-27 21:17:04 (GMT)
commit963816defca26c8817b0185c245f7b30ae365f23 (patch)
treec5bbe9850c5f78952cf0cd14143d1f08c43999bd /Objects
parent6636887104bb3ebe180682a8ce10fee8fbc0c46e (diff)
parent261896b5591e819fe9c874e69469783c16161586 (diff)
downloadcpython-963816defca26c8817b0185c245f7b30ae365f23.zip
cpython-963816defca26c8817b0185c245f7b30ae365f23.tar.gz
cpython-963816defca26c8817b0185c245f7b30ae365f23.tar.bz2
Merge 3.2 -> default (issue 13889)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/floatobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 4e0fa7d..a738249 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -902,9 +902,12 @@ double_round(double x, int ndigits) {
char *buf, *buf_end, shortbuf[100], *mybuf=shortbuf;
int decpt, sign;
PyObject *result = NULL;
+ _Py_SET_53BIT_PRECISION_HEADER;
/* round to a decimal string */
+ _Py_SET_53BIT_PRECISION_START;
buf = _Py_dg_dtoa(x, 3, ndigits, &decpt, &sign, &buf_end);
+ _Py_SET_53BIT_PRECISION_END;
if (buf == NULL) {
PyErr_NoMemory();
return NULL;
@@ -927,7 +930,9 @@ double_round(double x, int ndigits) {
/* and convert the resulting string back to a double */
errno = 0;
+ _Py_SET_53BIT_PRECISION_START;
rounded = _Py_dg_strtod(mybuf, NULL);
+ _Py_SET_53BIT_PRECISION_END;
if (errno == ERANGE && fabs(rounded) >= 1.)
PyErr_SetString(PyExc_OverflowError,
"rounded value too large to represent");