diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-29 17:28:20 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-29 17:28:20 +0000 |
commit | 0aa5d51cf115f2941ca20901d45a044f54792eb4 (patch) | |
tree | 812b04b3b753010a72bf17826ac146a641a5810f /py/obj.c | |
parent | c9fd6645b0a1af73f3854ddc2745596070985a18 (diff) | |
download | micropython-0aa5d51cf115f2941ca20901d45a044f54792eb4.tar.gz micropython-0aa5d51cf115f2941ca20901d45a044f54792eb4.zip |
py: Support mpz -op- float, mpz -op- complex, and complex -op- mpz.
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -195,6 +195,9 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) { } else if (MP_OBJ_IS_SMALL_INT(arg)) { *real = MP_OBJ_SMALL_INT_VALUE(arg); *imag = 0; + } 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)) { *real = mp_obj_float_get(arg); *imag = 0; |