-
Notifications
You must be signed in to change notification settings - Fork 194
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
Prevent overflow #471
Prevent overflow #471
Conversation
1606388
to
0fedfed
Compare
@czurnieden could you do me a favor and recompute the biggest number table for the overestimate test which is disabled now? |
If you want to make the maximum size dependent on That may take a day or two ;-) |
Uuh could we do it somehow differently? |
0fedfed
to
08d281c
Compare
@czurnieden I added a randomized test for now. |
7998b84
to
2f966ad
Compare
2f966ad
to
40177e1
Compare
@sjaeckel Right, I added a workaround using the tommath_c89.h header. |
@sjaeckel Good to merge? |
@sjaeckel Ping. Can we merge this? |
A new and improved It nagged me from the start on, that it has a lot of full bigint operations with up to twice the number of digits of the input, the trial exponentiations can overflow You can get that down to one trial exponentiation that does not overflow and up to two small trials. One of the trials is by multiplying with the base which can overflow but that overflow is usable by the trial, that's why I wanted the distinct error. The other trial is a division by the base. It is exact, but as long as we don't have "exact division" also slower than the multiplication for bigint bases. That together with a rather large "hidden constant" might make it significantly slower than the old method for small input but I have no benchmarks at this stage. So don't hold your breath ;-) |
disabled the overestimate test for the INT_MAX-1 number for now since this number is not allowed anymore.