Can someone explain math.fmod() please

Not a clue LOL. I know it takes 2 parameters and you send 2 numbers but i dont actually know what it is.

I asked a friend but his native language isnt english so he couldnt explain it.

So could someone explain please, and give an example of where it would be used.

Also im not a maths guy so quotient doesnt make sense, yes i already checked developer.roblox.com

4 Likes

It’s the same as the modulus % operator I think.

math.fmod(x, y) returns the same value as x % y

5 Likes

basically the remainder after dividing 2 numbers

2 Likes

Quotient is the result of division, kind of like how the result of addition is a sum, the result of subtraction is a difference, the result of multiplication is product.

Like mentioned by @blokav, it’s basically modulo.

1 Like

So its just the division of two numbers??

1 Like

cc @sjr04

math.fmod is the remainder of truncated divsion, not the remainder of floor division or modulo unlike the % operator so are you implying that math.fmod(-19, 12) returns 5 instead of -7?
Along with that, x % math.huge returns NaN (before Lua 5.3), math.fmod(x, math.huge) returns x.

print(math.fmod(-19, 12)) --> -7
print(-19 % 12) --> 5
8 Likes