mirror of
https://github.com/micropython/micropython.git
synced 2025-08-31 15:00:40 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user