summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
Diffstat (limited to 'extmod')
-rw-r--r--extmod/moductypes.c7
-rw-r--r--extmod/moduselect.c2
2 files changed, 4 insertions, 5 deletions
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index eb9ca57e3..cdbf49ad4 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -360,7 +360,7 @@ STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
return mp_obj_new_int_from_ll(((int64_t *)p)[index]);
#if MICROPY_PY_BUILTINS_FLOAT
case FLOAT32:
- return mp_obj_new_float(((float *)p)[index]);
+ return mp_obj_new_float_from_f(((float *)p)[index]);
case FLOAT64:
return mp_obj_new_float(((double *)p)[index]);
#endif
@@ -373,11 +373,10 @@ STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
#if MICROPY_PY_BUILTINS_FLOAT
if (val_type == FLOAT32 || val_type == FLOAT64) {
- mp_float_t v = mp_obj_get_float(val);
if (val_type == FLOAT32) {
- ((float *)p)[index] = v;
+ ((float *)p)[index] = mp_obj_get_float_to_f(val);
} else {
- ((double *)p)[index] = v;
+ ((double *)p)[index] = mp_obj_get_float_to_d(val);
}
return;
}
diff --git a/extmod/moduselect.c b/extmod/moduselect.c
index 122365607..80beb8e09 100644
--- a/extmod/moduselect.c
+++ b/extmod/moduselect.c
@@ -125,7 +125,7 @@ STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
if (n_args == 4) {
if (args[3] != mp_const_none) {
#if MICROPY_PY_BUILTINS_FLOAT
- float timeout_f = mp_obj_get_float(args[3]);
+ float timeout_f = mp_obj_get_float_to_f(args[3]);
if (timeout_f >= 0) {
timeout = (mp_uint_t)(timeout_f * 1000);
}