3 ms·
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 runni
by moron4hire 6y ago
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