diff options
Diffstat (limited to 'py/binary.c')
-rw-r--r-- | py/binary.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/binary.c b/py/binary.c index b29438770..33515e880 100644 --- a/py/binary.c +++ b/py/binary.c @@ -176,7 +176,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, size_t index) { #endif #if MICROPY_PY_BUILTINS_FLOAT case 'f': - return mp_obj_new_float(((float *)p)[index]); + return mp_obj_new_float_from_f(((float *)p)[index]); case 'd': return mp_obj_new_float(((double *)p)[index]); #endif @@ -244,7 +244,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte *p_base, byte * union { uint32_t i; float f; } fpu = {val}; - return mp_obj_new_float(fpu.f); + return mp_obj_new_float_from_f(fpu.f); } else if (val_type == 'd') { union { uint64_t i; double f; @@ -320,7 +320,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p uint32_t i32[2]; double f; } fp_dp; - fp_dp.f = mp_obj_get_float(val_in); + fp_dp.f = mp_obj_get_float_to_d(val_in); if (BYTES_PER_WORD == 8) { val = fp_dp.i64; } else { @@ -362,7 +362,7 @@ void mp_binary_set_val_array(char typecode, void *p, size_t index, mp_obj_t val_ ((float *)p)[index] = mp_obj_get_float(val_in); break; case 'd': - ((double *)p)[index] = mp_obj_get_float(val_in); + ((double *)p)[index] = mp_obj_get_float_to_d(val_in); break; #endif // Extension to CPython: array of objects |