I’ve been ripping my hair out at this. The modulus operator seems to not be acting like it should.
local t = (5259305/86400)%30
print(t)
Output you would get: 0.87158564814815
Expected Output: 2.02905285494
Any help would be much appreciated.
I’ve been ripping my hair out at this. The modulus operator seems to not be acting like it should.
local t = (5259305/86400)%30
print(t)
Output you would get: 0.87158564814815
Expected Output: 2.02905285494
Any help would be much appreciated.
Where did you get the expected output from? 5259305/86400
is 60.87158564814815
and 60.87158564814815 % 30
is 0.8715856481481481
.
You have confused between division and modulus. Modulus returns the Remainder of a division operation. The way you expected the output was like this, by dividing by 30:
local t = (5259305/86400)/30
print(t)
Yeah, I’m a bit thick and just noticed, thanks.