News for hackers. Stuff that matters.
Re:Testing for Divisibility by 19 by moron4hire on Monday November 23, 2020 @09:01AM (#25186822)
One other neat trick that I like is that calculating the N modulus after multiplying a series of numbers together can be done by applying the modulus to a running accumulator after each term in the series is multiplied. So if you have a series that will definitely overflow an IEEE float, you can keep the operation in bounds without using a BigNumber structure.

I.e. (a * b * c) % N = (((a * b) % N) * c) % N

There are no comments on this comment yet.