Float? No idea.
#1

I had a problem with floats.

static Float:testnumber = 3.01;
printf("%f", testnumber);

Results:

3.00.

Do you have any idea why I'm having 3.00 instead of 3.01?

Thanks.
Reply
#2

Try not using static.
Reply
#3

new Float:number = 0.01;
printf("%.2f", number);

Results: 0.00

new Float:number = 0.01;
printf("%.3f", number);

Results: 0.009
Reply
#4

Quote:
Originally Posted by Psymetrix
Посмотреть сообщение
Try not using static.
Why?


Reply
#5

Anyone have an idea why it doesn't give the right float?
Reply
#6

Quote:
Originally Posted by Gh05t_
Посмотреть сообщение
Why?


It was just a suggestion. Are floats accurate in PAWN?
Reply
#7

I don't think so, otherwise it would be 0.01 instead of 0.009.
Reply
#8

Sorry for double post, I found the problem.

If you want 0.01 then you can just add 0.001 to 0.009 which equals 0.01
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)