Hello all,
Suppose I wanted to print a floating point number (float or double) with 2 decimal places' precision. So, of course I would write,
printf("%.2f",x);
Now, suppose I want instead to print the number with the minimum number of decimal places required to print it accurately. So, if x==0.1 I want to print "0.1" but if x==1.1695 I want to print "1.1695", etc.
How do I do this?
Many thanks,
-- Joe
Suppose I wanted to print a floating point number (float or double) with 2 decimal places' precision. So, of course I would write,
printf("%.2f",x);
Now, suppose I want instead to print the number with the minimum number of decimal places required to print it accurately. So, if x==0.1 I want to print "0.1" but if x==1.1695 I want to print "1.1695", etc.
How do I do this?
Many thanks,
-- Joe