The Calc program has limited precision and can only accurately represent integers up to 2^61-1. Originally modulo was only implemented for integers, and it seemed to make no sense to perform the modulo operation when the number is not represented exactly. However, modulo has been extended to work with fractional numbers, and as long as the magnitude of the two operands to the modulo operator is comparable, modulo makes perfect sense. In the case of (a modulo b), a must be smaller than b*(2^61) for modulo to be interesting. E.g. 44e100 modulo 5e100 = 4e100 works in the current implementation. The question is what to return in the case of 44e100 modulo 3 ? Because of the limited precision, the program cannot distinguish between 44e100 and 44e100 + 1. If it cannot be accurately calculated by the program, what should the result be? Of the candidates I could think of, 0 or "nan", I chose 0. I didn't think more about it at the time, but I realize that "nan" may more accurately represent the situation: that we have no clue what the result should be. Any comments?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: NO
I mean, GREAT number Modulo ANY number is always zero...
Logged In: YES
user_id=1189103
Originator: NO
The Calc program has limited precision and can only accurately represent integers up to 2^61-1. Originally modulo was only implemented for integers, and it seemed to make no sense to perform the modulo operation when the number is not represented exactly. However, modulo has been extended to work with fractional numbers, and as long as the magnitude of the two operands to the modulo operator is comparable, modulo makes perfect sense. In the case of (a modulo b), a must be smaller than b*(2^61) for modulo to be interesting. E.g. 44e100 modulo 5e100 = 4e100 works in the current implementation. The question is what to return in the case of 44e100 modulo 3 ? Because of the limited precision, the program cannot distinguish between 44e100 and 44e100 + 1. If it cannot be accurately calculated by the program, what should the result be? Of the candidates I could think of, 0 or "nan", I chose 0. I didn't think more about it at the time, but I realize that "nan" may more accurately represent the situation: that we have no clue what the result should be. Any comments?
Logged In: NO
Yes, i think "nan" would be more appropriate.