Skip to content

Commit 0178aa9

Browse files
committed
py, unix: Allow to compile with -Wdouble-promotion.
Ref issue micropython#699.
1 parent b58da94 commit 0178aa9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

py/objstr.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,13 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa
12061206

12071207
case '%':
12081208
flags |= PF_FLAG_ADD_PERCENT;
1209-
pfenv_print_float(&pfenv_vstr, mp_obj_get_float(arg) * 100.0F, 'f', flags, fill, width, precision);
1209+
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
1210+
#define F100 100.0F
1211+
#else
1212+
#define F100 100.0
1213+
#endif
1214+
pfenv_print_float(&pfenv_vstr, mp_obj_get_float(arg) * F100, 'f', flags, fill, width, precision);
1215+
#undef F100
12101216
break;
12111217
#endif
12121218

unix/modtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void msec_sleep_tv(struct timeval *tv) {
5252
#endif
5353

5454
#if defined(MP_CLOCKS_PER_SEC)
55-
#define CLOCK_DIV (MP_CLOCKS_PER_SEC / 1000.0)
55+
#define CLOCK_DIV (MP_CLOCKS_PER_SEC / 1000.0F)
5656
#else
5757
#error Unsupported clock() implementation
5858
#endif

0 commit comments

Comments
 (0)