summaryrefslogtreecommitdiffstatshomepage
path: root/tools/mpy-tool.py
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2020-03-31 14:48:08 +0200
committerDamien George <damien.p.george@gmail.com>2020-04-18 22:42:24 +1000
commitbcf01d1686a8fa6d257daea25ce0d7df6e4ad839 (patch)
tree2513c71e685ead21c6ca44a0432500ca75c424f8 /tools/mpy-tool.py
parentdc4d119d3d96799bf848c6488b2ac49b933ab7cb (diff)
downloadmicropython-bcf01d1686a8fa6d257daea25ce0d7df6e4ad839.tar.gz
micropython-bcf01d1686a8fa6d257daea25ce0d7df6e4ad839.zip
all: Fix implicit conversion from double to float.
These are found when building with -Wfloat-conversion.
Diffstat (limited to 'tools/mpy-tool.py')
-rwxr-xr-xtools/mpy-tool.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index 0a9246503e..43d35503eb 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: