From bcf01d1686a8fa6d257daea25ce0d7df6e4ad839 Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 31 Mar 2020 14:48:08 +0200 Subject: all: Fix implicit conversion from double to float. These are found when building with -Wfloat-conversion. --- tools/mpy-tool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 0a9246503..43d35503e 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -332,12 +332,13 @@ class RawCode(object): "#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B" ) print( - "STATIC const mp_obj_float_t %s = {{&mp_type_float}, %.16g};" % (obj_name, obj) + "STATIC const mp_obj_float_t %s = {{&mp_type_float}, (mp_float_t)%.16g};" + % (obj_name, obj) ) print("#endif") elif type(obj) is complex: print( - "STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, %.16g, %.16g};" + "STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, (mp_float_t)%.16g, (mp_float_t)%.16g};" % (obj_name, obj.real, obj.imag) ) else: -- cgit v1.2.3