← index #17167PR #6294
Off-topic · high · value 0.203
QUERY · ISSUE

NRF52: build error, implicit conversion from 'float' to 'double'

openby permaBoxopened 2025-04-22updated 2025-06-09
bugport-nrf

Port, board and/or hardware

nrf port, nrf52 board

MicroPython version

mpy latest, nrf52 board

The build process has failed with a compiler configuration issue if support for double is configured.

Build error report:

CC ../../py/formatfloat.c
../../py/formatfloat.c: In function 'mp_format_float':
../../py/formatfloat.c:92:26: error: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Werror=double-promotion]
92 | #define fp_isless1(x) (x < 1.0)
| ^
../../py/formatfloat.c:183:16: note: in expansion of macro 'fp_isless1'
183 | } else if (fp_isless1(f)) {
| ^~~~~~~~~~
../../py/formatfloat.c:336:15: error: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Werror=double-promotion]
336 | f *= FPCONST(10.0);
| ^~
cc1: all warnings being treated as errors

Reproduction

mpconfigport.h

#if NRF51
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#else
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#endif

Expected behaviour

No response

Observed behaviour

Related build error report.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

ESP32 : make option MICROPY_FLOAT_IMPL

closedby rcolisteteopened 2020-07-29updated 2022-01-21
port-esp32

Implement make option MICROPY_FLOAT_IMPL on ESP32, so it is simpler to build ESP32 firmware with single or double precision float point numbers. For example :
[esp32]$ make -j8 MICROPY_FLOAT_IMPL=double
instead of changing the 'esp32/mpconfigport.h', line :
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
to
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
Batch scripts to build many ESP32 firmware variants with combinations of boards (GENERIC, GENERIC_SPIRAM, etc), single/double precision, etc, become possible.

This option MICROPY_FLOAT_IMPL can also be configured by each board via $BOARD/mpconfigboard.mk.

In this way the ESP32 building workflow becomes more compatible with STM32 one.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied