diff options
author | Damien George <damien.p.george@gmail.com> | 2015-08-20 23:30:12 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-20 12:35:17 +0100 |
commit | aaef1851a748af95f8b105ef2d1d4f35e6ede02b (patch) | |
tree | dec9fac8e9ed288aa0b4a2abfed093208c2dd12e /py/obj.c | |
parent | 60401d461ab41d94eeb174ae0f4db9a57d43880a (diff) | |
download | micropython-aaef1851a748af95f8b105ef2d1d4f35e6ede02b.tar.gz micropython-aaef1851a748af95f8b105ef2d1d4f35e6ede02b.zip |
py: Add mp_obj_is_float function (macro) and use it where appropriate.
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -268,7 +268,7 @@ mp_float_t mp_obj_get_float(mp_obj_t arg) { return MP_OBJ_SMALL_INT_VALUE(arg); } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) { return mp_obj_int_as_float(arg); - } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) { + } else if (mp_obj_is_float(arg)) { return mp_obj_float_get(arg); } else { if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { @@ -295,7 +295,7 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { } else if (MP_OBJ_IS_TYPE(arg, &mp_type_int)) { *real = mp_obj_int_as_float(arg); *imag = 0; - } else if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) { + } else if (mp_obj_is_float(arg)) { *real = mp_obj_float_get(arg); *imag = 0; } else if (MP_OBJ_IS_TYPE(arg, &mp_type_complex)) { |