While cleaning up some code, both in R19 and R20, I noticed I sometimes use a % b to calculate a modulo, and sometimes LModulo(a, b) (where a and b are both Int32 variables or values).
Obviously, the LModulo is defined in the Cinema 4D SDK and thus preferred. But what is the benefit of using it over the regular modulus operator, or put differently, what are the cons of using the modulus operator?
a % b
Hi Daniel, thanks for reaching out us.
With regard to the LModulo function, being it part of the cinema.framework, you can see, by looking at the implementation, that it:
The code, available in the framework is:
if (a >= 0)
return a % b;
a -= (a / b) * b;
if (a < 0)
a += b;
Thanks for the info.