summaryrefslogtreecommitdiffstatshomepage
path: root/py/formatfloat.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-03-01 16:02:59 +1100
committerDamien George <damien.p.george@gmail.com>2018-03-01 16:02:59 +1100
commit7b050fa76c6a763043739d40c82dde839d7f8fd9 (patch)
tree8ebe60cfaf1b7c9cf7e1e1dad7a28c33f7432d27 /py/formatfloat.c
parentbc12eca461a317df842ce2e616afa97670cd0ce3 (diff)
downloadmicropython-7b050fa76c6a763043739d40c82dde839d7f8fd9.tar.gz
micropython-7b050fa76c6a763043739d40c82dde839d7f8fd9.zip
py/formatfloat: Fix case where floats could render with a ":" character.
Prior to this patch, some architectures (eg unix x86) could render floats with a ":" character in them, eg 1e+39 would come out as ":e+38" (":" is just after "9" in ASCII so this is like 10e+38). This patch fixes some of these cases.
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 22dd8aaacc..60dcee6f54 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -258,7 +258,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
}
// It can be that f was right on the edge of an entry in pos_pow needs to be reduced
- if (f >= FPCONST(10.0)) {
+ if ((int)f >= 10) {
e += 1;
f *= FPCONST(0.1);
}