Hello,
nRF52840-DK, SDK17.2,
double b=log10(0.00000226497650146484375);
NRF_LOG_INFO("log10=%d",b);
b retuan 0.0;
why?
The calculation result on the computer is -5.64
Best regards
Hello,
nRF52840-DK, SDK17.2,
double b=log10(0.00000226497650146484375);
NRF_LOG_INFO("log10=%d",b);
b retuan 0.0;
why?
The calculation result on the computer is -5.64
Best regards
Hi,
You need to use NRF_LOG_FLOAT_MARKER and NRF_LOG_FLOAT(val) when printing floats using NRF_LOG, see Logging customization in logger documentation.
Have you checked using a debugger if b is calculated/stored correctly in the double before begin passed to NRF_LOG?
Best regards,
Jørgen
Yes, but note that NRF_LOG_FLOAT_MARKER may limit the number of decimals in the output, see the %02 in the format:
#define NRF_LOG_FLOAT_MARKER "%s%d.%02d"
Yes, but note that NRF_LOG_FLOAT_MARKER may limit the number of decimals in the output, see the %02 in the format:
#define NRF_LOG_FLOAT_MARKER "%s%d.%02d"