diff options
author | Damien George <damien.p.george@gmail.com> | 2016-11-03 12:33:01 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-11-03 12:33:01 +1100 |
commit | 561844f3ba2dc81ce37c58468099042e27cd422b (patch) | |
tree | 95bc16e21265b3a517710325be39a50002b8afa2 /py/parsenum.c | |
parent | ca973bd3083492777095a07c20965a4644899ec9 (diff) | |
download | micropython-561844f3ba2dc81ce37c58468099042e27cd422b.tar.gz micropython-561844f3ba2dc81ce37c58468099042e27cd422b.zip |
py: Add MICROPY_FLOAT_CONST macro for defining float constants.
All float constants in the core should use this macro to prevent
unnecessary creation of double-precision floats, which makes code less
efficient.
Diffstat (limited to 'py/parsenum.c')
-rw-r--r-- | py/parsenum.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/parsenum.c b/py/parsenum.c index 1010ad3055..b1c449c9b8 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -227,7 +227,7 @@ mp_obj_t mp_parse_num_decimal(const char *str, size_t len, bool allow_imag, bool } else { if (in == PARSE_DEC_IN_FRAC) { dec_val += dig * frac_mult; - frac_mult *= 0.1; + frac_mult *= MICROPY_FLOAT_CONST(0.1); } else { dec_val = 10 * dec_val + dig; } |