-
Notifications
You must be signed in to change notification settings - Fork 148
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
lcm on i64 falls victim to overflow checking #166
Comments
Ah, I see. It currently does `self*other/gcd`, so that multiplication will
overflow. Doing the division first should solve this, and we know this is
sound since GCD is a divisor.
Care to try that and add your test case?
(And of course an LCM that's truly too large will still overflow.)
|
Oh yes, the gcd should indeed divide either one. Okay I'll try that. |
pnkfelix
added a commit
to pnkfelix/num
that referenced
this issue
Feb 17, 2016
pnkfelix
added a commit
to pnkfelix/num
that referenced
this issue
Feb 18, 2016
homu
added a commit
that referenced
this issue
Feb 18, 2016
Reorder ops in LCM to avoid overflow. Reorder ops in LCM to avoid overflow. Fix #166
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This signals overflow for me when run in a debug build:
The text was updated successfully, but these errors were encountered: