Floats and Zeros
#1

Hey ya'll, can you show me how to do this?

pawn Код:
new Float:fl = 0.00010;
printf("%f", fl);
That would print "0.00010", but I don't want it to print the last zero. How can I do it?

pawn Код:
new Float:fl = 0.00100;
printf("%f", fl);
Same for that one, I don't want it to print the last 2 zeros.

Help
Reply
#2

Код:
new Float:fl = 0.00100;
printf("%.3f", fl);
Reply
#3

Quote:
Originally Posted by Jefff
Код:
new Float:fl = 0.00100;
printf("%.3f", fl);
No, I don't want to print 3 numbers after the dot. I want to get rid of the zeros after the last number greater than 0.

Like saying 4.0 == 4 or 4.0010 == 4.001.
Reply
#4

So you want a normal number like 4.0? do
pawn Код:
%.0f
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)