py: Support mpz -op- float, mpz -op- complex, and complex -op- mpz.

This commit is contained in:
Damien George
2014-03-29 17:28:20 +00:00
parent c9fd6645b0
commit 0aa5d51cf1
2 changed files with 11 additions and 0 deletions

View File

@@ -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;