View Full Version : Modulus algorithm

04-10-2004, 06:49 AM
I'm looking for the modulus algorithm. I'm trying to make a modulus function that operates on a base N number (represented as a string most likely) but haven't had any luck when searching for it. Links are welcome.

04-10-2004, 08:03 AM
I don't suppose this would work for you in some form, would it?

int r = a - b * (int)( (double)a / b )

Zach L.
04-10-2004, 10:34 AM
The modulus operation (as related to integers), works independently of the base.