diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-22 20:54:01 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-22 20:54:01 +0000 |
commit | eabdf6718a8d9d10c810b8cd440b82a11d517205 (patch) | |
tree | 955749df1f3f5ba17d5dac9fc742606dc5d0794a /py/obj.c | |
parent | 8138205bea96afb6b59e3147fbaab754cb218ea2 (diff) | |
download | micropython-eabdf6718a8d9d10c810b8cd440b82a11d517205.tar.gz micropython-eabdf6718a8d9d10c810b8cd440b82a11d517205.zip |
py: Add function to convert long int to float.
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -176,6 +176,8 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) { return 1; } else if (MP_OBJ_IS_SMALL_INT(arg)) { return MP_OBJ_SMALL_INT_VALUE(arg); + } else if (MP_OBJ_IS_TYPE(arg, &int_type)) { + return mp_obj_int_as_float(arg); } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) { return mp_obj_float_get(arg); } else { |