What does the "%" sign do in this example.
var A = (JD + 1.5) % 7;
The results are A = 0-6. Where JD is a large number like "2456123.234".
% is the modulo or remainder operator - %7 wil always return a result between 0 and 6 because when you subtract as many 7s as you can from a number without it ending up negative you will have somewhere between 0 and 6 left as the remainder.
How do you mathematically represent the % modulo or remainder operator?
The modulus operator (the % symbol) provides the remainder after dividing by the number.
20/7 = 2 + 6/7
20 % 7 = 6
This topic is now closed. New replies are no longer allowed.