Why is PAWN returning the wrong answer?
#1

I was curious to something, and decided to use PAWN to work out the speed (dont ask why I was just bored)

I ran this:

pawn Код:
#include <a_samp>

main()
{
    new Float:dis=0.1,
        Float:time=3600,
        Float:speed = 0;
    speed = (dis/time);
    printf("%d",speed);
}
which returned 938017875

How is that possible?

distance is KM so 0.1 KM = 100 mtrs
time is seconds so 3600 seconds is 1 hour

When I put this in my calculator I get 0.000027777

Is this because there is a limitation to pawn that it can't give out 0.000027777?

But then I run it like this:

pawn Код:
#include <a_samp>

main()
{
    new Float:dis=1.0,
        Float:time=1.0,
        Float:speed = 0;
    speed = (dis/time);
    printf("%d",speed);
}
and I get answer 1065353216

but 1.0/1.0 = 1

what is happening here? Im really confused..
Reply


Messages In This Thread
Why is PAWN returning the wrong answer? - by pagie1111 - 30.05.2011, 16:51
Re: Why is PAWN returning the wrong answer? - by RyDeR` - 30.05.2011, 16:53
Re: Why is PAWN returning the wrong answer? - by pagie1111 - 30.05.2011, 16:55
Re: Why is PAWN returning the wrong answer? - by Sasino97 - 30.05.2011, 16:57
Re: Why is PAWN returning the wrong answer? - by pagie1111 - 30.05.2011, 17:03

Forum Jump:


Users browsing this thread: 2 Guest(s)