Page 1 of 1

Travel Speed

Posted: Fri Nov 23, 2012 12:54 pm
by Andu
If a guy walking on a road carries 1000 grams, his speed is calculated (10 - (1000/5000)) = 9,8

Is his speed rounded down, to the closest whole pixel or stay at that exact number?

The speed is:
a. 9
b. 10
c. 9.8

Would be interesting to know how it is.

Re: Travel Speed

Posted: Fri Nov 23, 2012 3:51 pm
by EchoMan
The "speed" variable in the db is an integer, but the code doesn't round anything, so default rounding behaviour of MySQL applies. E.g:

Code: Select all

9.49999999999... is rounded down to 9
9.50000000000... is rounded up to 10

Re: Travel Speed

Posted: Sat Nov 24, 2012 12:13 pm
by Andu
Yay, thanks! :lol: