CBFalconer wrote:
> "Piotr B." wrote:
>
>>1. How to strip trailing zeroes from float values?
>>printf("%f %f", 1.777, 1.2) displays "1.777000 1.200000",
>>while I want to have "1.777 1.2", without loosing 6-digit
>>precision.
>
>
> printf("%.3f %.2f", 1.777, 1.2);
%.2f will still print one trailing 0 after 1.2, so you probably
meant
printf(%.3f %.1f", 1.777, 1.2);
>
> Read the standard. Don't cross post between c.l.c and c.l.c++;
> they are different languages.
They have a lot in common. Up until the new C Standard (come
in 1999, IIRC) they shared the same standard library.
> Follow-ups set. c.l.c++ probably
> won't use printf anyhow.
Just to let you know, 'printf' is just as much part of C++ as it
is of C circa 1998. Whether to use any particular part of the
Standard library is, of course, up to the programmer.
Be well!
|