Modular arithmetic bug
Issue #765
duplicate
I am running Speedcrunch version 0.12.0-1 on Linux Debian version 9.1. I have been testing various modular arithmetic problems where I know the exact answer (by applying Euler's phi-function and Fermat's little theorem), and I'm not getting correct results. For example, Speedcrunch says that mod(9129;17)=6, but the correct answer is 9. Also, Speedcrunch says mod(2400;13) = 9, but the correct answer is 3. For another, Speedcrunch says mod(2**345;11) = 8, but the correct answer is 10.
Comments (2)
-
-
- changed status to duplicate
Duplicate of #295.
- Log in to comment
Speedcrunch's math engine is not arbitrary precision. As explained in the documentation, only ~80 significant digits are stored. Beyond that, the unit digit is lost, and integer math stops working.
I am leaving the issue open, as I think SC should raise an error when trying to apply
mod
to a number that exceeds that range.