-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Count number of "wraps" when adding to ModNum*
#1
Comments
Thank you for your message! It got thrown into my spam folder and I just saw it now.
What you suggest is a really interesting feature. What do you have in mind in terms of the API? Would it be a separate "counting-add" operation? If so, I would be happy to include it in the library.
Thanks for your message and your interest!
|
I have thought of a way to implement this. It needs to take into account the original dividend. All operations ultimately funnel down to a call to So, to do this:
|
Thanks again for the suggestion, @linclelinkpart5! I have now implemented it as follows:
Due to the delay between this implementation and when you posted the issue, it may or may not be useful to you at this point, but I am guessing that your suggestion indicates something that would be useful to many people, so I am pleased that I was finally able to incorporate it. |
I've found myself in need of a library like this, and it fulfills almost all of my uses! However, I also need to count how many times the modulated value is wrapped around the modulus when performing an addition. For example, if I have
8 mod 17
, and add42
to it, I'd get the usual16 mod 17
, along with a2
to indicate that the modulated value wrapped around the modulus twice.I'm happy to add this functionality myself and make a PR, but wanted to get feedback beforehand. Namely, I'd love some advice on what to name this method.
The text was updated successfully, but these errors were encountered: