Whats the difference?
#2

%.2f specifies the precision of the float to print out to 2. This would print out a float to 2 decimal places:

pawn Код:
// ..
printf( "%.2f", 3.141592 );
//Would output 3.14, because precision is 2 places.

// ..
printf( "%f", 3.141592 );
//Would output 3.141592, because there is no precision set.

// ..
printf( "%.4f", 3.141592 );
//Would output 3.1415, because precision is 4 places.
For more info, see this article I wrote on the wiki about floats:

https://sampwiki.blast.hk/wiki/Floats

and more specifically;
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_String
Reply


Messages In This Thread
Whats the difference? - by Joshb93 - 26.11.2011, 15:55
Re: Whats the difference? - by blewert - 26.11.2011, 16:07
Re: Whats the difference? - by fordawinzz - 26.11.2011, 16:08
Re: Whats the difference? - by TheArcher - 26.11.2011, 16:09
Re: Whats the difference? - by Joshb93 - 26.11.2011, 16:11
Re: Whats the difference? - by TheArcher - 26.11.2011, 16:13
Re: Whats the difference? - by blewert - 26.11.2011, 16:22

Forum Jump:


Users browsing this thread: 1 Guest(s)