py: Add mp_obj_is_float function (macro) and use it where appropriate.
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 45fb3ff..dd8499b 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -93,7 +93,7 @@
     if (0) {
         // dummy
 #if MICROPY_PY_BUILTINS_FLOAT
-    } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_float)) {
+    } else if (mp_obj_is_float(o_in)) {
         mp_float_t value = mp_obj_float_get(o_in);
         // TODO check for NaN etc
         if (value < 0) {
diff --git a/py/obj.c b/py/obj.c
index 34ecdab..9d77d25 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -268,7 +268,7 @@
         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 @@
     } 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)) {
diff --git a/py/obj.h b/py/obj.h
index 7451868..6e0e18b 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -568,6 +568,7 @@
     mp_obj_base_t base;
     mp_float_t value;
 } mp_obj_float_t;
+#define mp_obj_is_float(o) MP_OBJ_IS_TYPE((o), &mp_type_float)
 mp_float_t mp_obj_float_get(mp_obj_t self_in);
 mp_obj_t mp_obj_float_binary_op(mp_uint_t op, mp_float_t lhs_val, mp_obj_t rhs); // can return MP_OBJ_NULL if op not supported
 
diff --git a/py/objfloat.c b/py/objfloat.c
index b8ab882..268fe89 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -72,7 +72,7 @@
                 mp_uint_t l;
                 const char *s = mp_obj_str_get_data(args[0], &l);
                 return mp_parse_num_decimal(s, l, false, false, NULL);
-            } else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) {
+            } else if (mp_obj_is_float(args[0])) {
                 // a float, just return it
                 return args[0];
             } else {
@@ -121,7 +121,7 @@
 }
 
 mp_float_t mp_obj_float_get(mp_obj_t self_in) {
-    assert(MP_OBJ_IS_TYPE(self_in, &mp_type_float));
+    assert(mp_obj_is_float(self_in));
     mp_obj_float_t *self = self_in;
     return self->value;
 }
diff --git a/py/objint.c b/py/objint.c
index 1ff89d6..dcc771e 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -60,7 +60,7 @@
                 const char *s = mp_obj_str_get_data(args[0], &l);
                 return mp_parse_num_integer(s, l, 0, NULL);
 #if MICROPY_PY_BUILTINS_FLOAT
-            } else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) {
+            } else if (mp_obj_is_float(args[0])) {
                 return mp_obj_new_int_from_float(mp_obj_float_get(args[0]));
 #endif
             } else {
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 2255fd6..18e698f 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -178,7 +178,7 @@
     } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_int)) {
         zrhs = &((mp_obj_int_t*)rhs_in)->mpz;
 #if MICROPY_PY_BUILTINS_FLOAT
-    } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_float)) {
+    } else if (mp_obj_is_float(rhs_in)) {
         return mp_obj_float_binary_op(op, mpz_as_float(zlhs), rhs_in);
 #if MICROPY_PY_BUILTINS_COMPLEX
     } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_complex)) {
diff --git a/py/objstr.c b/py/objstr.c
index f94744a..6ada37b 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -827,15 +827,15 @@
 STATIC bool arg_looks_numeric(mp_obj_t arg) {
     return arg_looks_integer(arg)
 #if MICROPY_PY_BUILTINS_FLOAT
-        || MP_OBJ_IS_TYPE(arg, &mp_type_float)
+        || mp_obj_is_float(arg)
 #endif
     ;
 }
 
 STATIC mp_obj_t arg_as_int(mp_obj_t arg) {
 #if MICROPY_PY_BUILTINS_FLOAT
-    if (MP_OBJ_IS_TYPE(arg, &mp_type_float)) {
-        return mp_obj_new_int_from_float(mp_obj_get_float(arg));
+    if (mp_obj_is_float(arg)) {
+        return mp_obj_new_int_from_float(mp_obj_float_get(arg));
     }
 #endif
     return arg;
diff --git a/py/runtime.c b/py/runtime.c
index 4e05577..dd2c177 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -458,7 +458,7 @@
                 return mp_obj_new_int(lhs_val);
             }
 #if MICROPY_PY_BUILTINS_FLOAT
-        } else if (MP_OBJ_IS_TYPE(rhs, &mp_type_float)) {
+        } else if (mp_obj_is_float(rhs)) {
             mp_obj_t res = mp_obj_float_binary_op(op, lhs_val, rhs);
             if (res == MP_OBJ_NULL) {
                 goto unsupported_op;