summaryrefslogtreecommitdiffstatshomepage
path: root/py/formatfloat.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/formatfloat.c')
-rw-r--r--py/formatfloat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/formatfloat.c b/py/formatfloat.c
index 4228f99ff5..22dd8aaacc 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -341,7 +341,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
// Round
// If we print non-exponential format (i.e. 'f'), but a digit we're going
// to round by (e) is too far away, then there's nothing to round.
- if ((org_fmt != 'f' || e <= 1) && f >= FPCONST(5.0)) {
+ if ((org_fmt != 'f' || e <= num_digits) && f >= FPCONST(5.0)) {
char *rs = s;
rs--;
while (1) {