Is there a printf width specifier which can be applied to a floating point specifier that would automatically format the output to the necessary number of s
printf
Simply use the macros from and the variable-width conversion specifier (".*"):
".*"
float f = 3.14159265358979323846; printf("%.*f\n", FLT_DIG, f);