Alternative for '%' in PAWN
#13

Quote:
Originally Posted by Babul
Посмотреть сообщение
the modulo operator returns the remainder of 2 integers. for floats, you simply need to reinvent the formula:
Код:
new Float:a=10.0;
new Float:b=4.0;
new result=floatround((a/b),floatround_floor)*b;
10.0 / 4.0 = 2.5
round_floor of 2.5 = 0.5
0.5 * 4.0 = 2.0
...looks similar to
10 % 4 = 2

another test: 100.0 % 3.0
100.0/3.0=33.333333
0.333333*3.0=1.000000
100%33=1
Your theory is good, but try it out
Reply


Messages In This Thread
Alternative for '%' in PAWN - by Jochemd - 01.06.2012, 09:31
Re: Alternative for '%' in PAWN - by Vince - 01.06.2012, 09:40
Re: Alternative for '%' in PAWN - by Jochemd - 01.06.2012, 09:44
Re: Alternative for '%' in PAWN - by MP2 - 01.06.2012, 09:51
Re: Alternative for '%' in PAWN - by Vince - 01.06.2012, 09:58
Re: Alternative for '%' in PAWN - by Jochemd - 01.06.2012, 09:58
Re: Alternative for '%' in PAWN - by MP2 - 01.06.2012, 10:02
Re: Alternative for '%' in PAWN - by Jochemd - 01.06.2012, 10:04
Re: Alternative for '%' in PAWN - by MP2 - 01.06.2012, 10:06
Re: Alternative for '%' in PAWN - by MadeMan - 01.06.2012, 10:07
Re: Alternative for '%' in PAWN - by Vince - 01.06.2012, 10:29
Re: Alternative for '%' in PAWN - by Babul - 01.06.2012, 10:29
Re: Alternative for '%' in PAWN - by MadeMan - 01.06.2012, 10:36

Forum Jump:


Users browsing this thread: 3 Guest(s)