How to display the float number with 9 decimal places. example: 0.123456789
I have tried with below code, but the terminal displays The number is lf.
double number1=0.123456789;
PRINTF("The number is %lf", number1);
Solved! Go to Solution.
As Alice_Yang suggested, just specifiy the precision in the format string.
If you don't, the default value (usually 6 digits) is used.
> Double data types
> How to display the float number with 9 decimal places. example: ...
I hope you realized that "double" and "float" are different types of different size.
Only "float" is natively supported by Cortex M FPUs, and several clib implementations (i.e. printf()/scanf()) have no or limited support for "double" either.
Check the respective library documentation.