03.01.2014, 00:34
Haha sorry I'm so stupid. I messed up with example 1. I was for some reason thinking that you have the minutes already but in most times you get the input value of seconds or firstly in most cases milliseconds and then covert them into seconds. I fixed that anyways.
Also discovered that you don't need a float round at all as it is apparently by default rounding down when dividing (I did try to divide values that could have most likely been rounded upwards but instead was still rounded upwards. 50/60 was rounded down to 0. 110/60 was rounded down to 1 instead of up to 2.
This is basically what the modulo operator does:
I didn't understand it until now when I read it carefully:
(10/4 - quotaOf(10/4)) * 4 is what modulo does.
Thanks for reading and clarifying and pointing out fails!
Also discovered that you don't need a float round at all as it is apparently by default rounding down when dividing (I did try to divide values that could have most likely been rounded upwards but instead was still rounded upwards. 50/60 was rounded down to 0. 110/60 was rounded down to 1 instead of up to 2.
This is basically what the modulo operator does:
Code:
new Float:a = 10.0; new Float:b = 4.0; new result=((a/b)-floatround((a/b),floatround_floor))*b;
(10/4 - quotaOf(10/4)) * 4 is what modulo does.
Thanks for reading and clarifying and pointing out fails!