For integer type %.4d is the same as %04d. Add 0 in front and output 4 bits.
For floating point types.
%.nf is reserved to n decimal places.
%m.nf is to output n decimal places, including decimals, integers, and the whole decimal point occupies m places.