views:

82

answers:

2

What does %.8Ff format specifier in printf do?
What does F mean?

+5  A: 

According to the manual:

The F conversion specifier produces "INF", "INFINITY", or "NAN" instead of "inf", "infinity", or "nan", respectively.

In your format string %.8Ff, the f is treated as a literal character and printed as an f.

codaddict
But you're not supposed to use both like that. It will result in the `F` not being part of the conversion specification. This is probably undesired, unless you want output like INFf or NANf. :)
Matthew Flaschen
@Matthew: Right,his `f` is a literal `f` no a part of format specifier.
codaddict
+1  A: 

One possible use of putting a literal f after the format specifier could be to print a string that's later to be parsed by a C or C++ compiler as a float constant instead of double constant.

R..