Why wont this work? (kind of math formula)
#4

Another important thing if you do maths with integer, always use the division as last!
Lets check out this example, normally you would think it works like that

158 / 4 * 3 = 39.5 * 3 = 118.5
158 * 3 / 4 = 474 / 4 = 118.5

But the truth is that the fractional part is cut off each time resulting in

158 / 4 * 3 = 39.5 * 3 => 39 * 3 = 117
158 * 3 / 4 = 474 / 4 = 118.5 => 118

pawn Код:
new robmoney = (((400 - rob[id]) * 3) / 4);
Reply


Messages In This Thread
Why wont this work? (kind of math formula) - by 101 - 30.12.2012, 00:27
Re: Why wont this work? (kind of math formula) - by Threshold - 30.12.2012, 00:29
Re: Why wont this work? (kind of math formula) - by 101 - 30.12.2012, 00:30
AW: Why wont this work? (kind of math formula) - by Nero_3D - 30.12.2012, 01:08
Re: Why wont this work? (kind of math formula) - by Threshold - 30.12.2012, 01:14
AW: Re: Why wont this work? (kind of math formula) - by Nero_3D - 30.12.2012, 12:04

Forum Jump:


Users browsing this thread: 1 Guest(s)