Skip to content
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

Arithmetic in Karatsuba algorithm should be discard() not unchecked() #5

Closed
oscbyspro opened this issue May 23, 2024 · 0 comments
Closed
Labels
bug please fix this :(

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented May 23, 2024

I'm writing more multiplication tests for the various data integer algorithms, and it became apparent that at least some of the arithmetic inside the Karatsuba algorithm should be allowed to overflow. In particular, the unchecked() debug assertion was triggered by [~0] x [~0], which usually does not take the Karatsuba path given the 16-element threshold. Tangentially, I kind of thought there would be a lower limit to the algorithm, but it just works if you take away the debug overflow assertions.

@oscbyspro oscbyspro added the bug please fix this :( label May 23, 2024
@oscbyspro oscbyspro added this to the Ultimathnum 0.3.0 milestone May 23, 2024
oscbyspro added a commit that referenced this issue May 24, 2024
I'm writing more multiplication tests for the various data integer algorithms, and it became apparent that at least some of the arithmetic inside the Karatsuba algorithm should be allowed to overflow. In particular, the unchecked() debug assertion was triggered by [~0] x [~0], which usually does not take the Karatsuba path given the 16-element threshold. Tangentially, I kind of thought there would be a lower limit to the algorithm, but it just works if you take away the debug overflow assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug please fix this :(
Projects
None yet
Development

No branches or pull requests

1 participant