[Python-checkins] r71131 - python/branches/py3k-short-float-repr/Python/pystrtod.c
mark.dickinson
python-checkins at python.org
Sat Apr 4 11:00:21 CEST 2009
Author: mark.dickinson
Date: Sat Apr 4 11:00:21 2009
New Revision: 71131
Log:
Force precision of at least 1 for 'g' format
Modified:
python/branches/py3k-short-float-repr/Python/pystrtod.c
Modified: python/branches/py3k-short-float-repr/Python/pystrtod.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/pystrtod.c (original)
+++ python/branches/py3k-short-float-repr/Python/pystrtod.c Sat Apr 4 11:00:21 2009
@@ -538,6 +538,10 @@
Py_ssize_t n_digits_after_decimal = 0;
Py_ssize_t n_digits;
+ /* precision of 0 makes no sense for 'g' format; interpret as 1 */
+ if (precision == 0 && format_code == 'g')
+ precision = 1;
+
/* _Py_dg_dtoa returns a digit string (no decimal point or
exponent) */
digits = _Py_dg_dtoa(d, mode, precision, &decpt, &sign, &digits_end);
More information about the Python-checkins
mailing list