diff options
| author | stijn | 2020-04-13 20:56:31 +0200 |
|---|---|---|
| committer | Damien George | 2020-04-18 22:42:24 +1000 |
| commit | 70affd9ba22e7f62666a9a2fafc2a3c0be9ef95a (patch) | |
| tree | 068485d00339bf0b89a5b8ea328396ffa21a0b14 /py/runtime.c | |
| parent | bcf01d1686a8fa6d257daea25ce0d7df6e4ad839 (diff) | |
all: Fix implicit floating point to integer conversions.
These are found when building with -Wfloat-conversion.
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/runtime.c b/py/runtime.c index 1fa9e73f2..79ca45fb1 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -473,7 +473,7 @@ mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) { case MP_BINARY_OP_INPLACE_POWER: if (rhs_val < 0) { #if MICROPY_PY_BUILTINS_FLOAT - return mp_obj_float_binary_op(op, lhs_val, rhs); + return mp_obj_float_binary_op(op, (mp_float_t)lhs_val, rhs); #else mp_raise_ValueError(MP_ERROR_TEXT("negative power with no float support")); #endif @@ -535,7 +535,7 @@ mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) { } #if MICROPY_PY_BUILTINS_FLOAT } else if (mp_obj_is_float(rhs)) { - mp_obj_t res = mp_obj_float_binary_op(op, lhs_val, rhs); + mp_obj_t res = mp_obj_float_binary_op(op, (mp_float_t)lhs_val, rhs); if (res == MP_OBJ_NULL) { goto unsupported_op; } else { @@ -544,7 +544,7 @@ mp_obj_t mp_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) { #endif #if MICROPY_PY_BUILTINS_COMPLEX } else if (mp_obj_is_type(rhs, &mp_type_complex)) { - mp_obj_t res = mp_obj_complex_binary_op(op, lhs_val, 0, rhs); + mp_obj_t res = mp_obj_complex_binary_op(op, (mp_float_t)lhs_val, 0, rhs); if (res == MP_OBJ_NULL) { goto unsupported_op; } else { |
