Is there a reason for this? It seems most just type MODULO when expressing this operation, that always seemed cumbersome. Why not assign a official notation for it?
Isn’t % modulus operator? Or am I just confusing things up?
Yup. No idea what the OP is talking about. Most people use that.
I’m pretty sure that’s not on an official notation. It’s only seen in programming languages and a lot of languages don’t even use it. A list is shown here Modulo - Wikipedia
To say it bluntly: All major languages of the modern era use % as the modulus operator symbol.
e.g. C, C++, C#, Java, Python, Javascript, Perl, PHP, Go are just a few that use it.
Since Unity can handle 3 types of languages: C#, Javascript (unityscript), and Boo (python)… % is the operator to use in all three cases.
From the wikipedia link you posted, modulo is often is often displayed as mod(), much like getting sine is sin(). And yeah as others posted % is often used, which isn’t limited to programming according to your wikipedia link!
Yeah, I think notation-wise “mod” is just used. % is a language notation (C++ and C# as well as others). In languages like VB you actually use “Mod”.
If you’re talking about written maths, it’s mod (or modulo), which perhaps basic and COBOL would use. Everything remotely modern uses %.
Note that % in .NET/Mono is actually, specifically, a remainder function.
This is true and worth taking into consideration. % and Mod work identically when the dividend and divisor are both positive values, but will give different results when either is a negative number. Usually when people think they want mod they actually just want a simple remainder function anyway, so % is usually accurate to the desired behavior.
%(remainder) == ((x % y) = (x - (y * int(x/y))))
mod == ((x mod y) = (x - (y * floor(x/y))))
A common example is -9%7 where % will give you -2 and mod will give you 5.
There’s also fmod for shaders and float work, just throwing it out there. And Math.IEEERemainder(Double, Double) Method (System) | Microsoft Learn for C#
Useful info, thanks all.