It actually can do it, it just works a little different:
- Code: Select all
printf("%.2f", 1.4); = "1.40"
printf("%.1f", 1.4); = "1.4"
printf("% 4.1f", 1.4); = " 1.4"
printf("%04.1f", 1.4); = "01.4"
printf("% 6.1f", 1.4); = " 1.4"
printf("%06.1f", 1.4); = "0001.4"
In other words the number includes the decimal point and the fraction part.
Just thought I would share.