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

Extended GCD on BigUint doesn't work #418

Closed
mhogrefe opened this issue Jun 11, 2022 · 2 comments
Closed

Extended GCD on BigUint doesn't work #418

mhogrefe opened this issue Jun 11, 2022 · 2 comments

Comments

@mhogrefe
Copy link
Contributor

use num::{BigUint, Integer, One};

fn main() {
    BigUint::one().extended_gcd(&BigUint::one());
}

fails with
thread 'main' panicked at 'Cannot subtract b from a because b is larger than a.'

Maybe the implementation should be specific to BigInt rather than being part of the Integer trait?

@cuviper
Copy link
Member

cuviper commented Jun 15, 2022

Yeah, I regret not making that require Signed -- see rust-num/num-integer#40.

It's still useful in the Integer trait for other signed integer types, like i32.

@mhogrefe
Copy link
Contributor Author

Thanks for responding! That makes sense. I'll close this since it's a dupe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants