From eabdf6718a8d9d10c810b8cd440b82a11d517205 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 22 Mar 2014 20:54:01 +0000 Subject: py: Add function to convert long int to float. --- py/objint.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'py/objint.c') diff --git a/py/objint.c b/py/objint.c index 9cba1ce744..70f44ac1e5 100644 --- a/py/objint.c +++ b/py/objint.c @@ -101,6 +101,12 @@ machine_int_t mp_obj_int_get_checked(mp_obj_t self_in) { return MP_OBJ_SMALL_INT_VALUE(self_in); } +#if MICROPY_ENABLE_FLOAT +mp_float_t mp_obj_int_as_float(mp_obj_t self_in) { + return MP_OBJ_SMALL_INT_VALUE(self_in); +} +#endif + #endif // MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE const mp_obj_type_t int_type = { -- cgit v1.2.3