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

BigInt properly recognized #96

Open
janus opened this issue Jun 9, 2021 · 3 comments
Open

BigInt properly recognized #96

janus opened this issue Jun 9, 2021 · 3 comments

Comments

@janus
Copy link

janus commented Jun 9, 2021

What could be causing the below? I have not been able to figure if there is another crate with same name.

use num_bigint::{BigUint, BigInt};
use num_rational::BigRational;

   |
38 |     let f = BigRational::new(BigInt::one(), BigInt::one());
   |                                             ^^^^^^^^^^^^^ expected struct `num_bigint::bigint::BigInt`, found struct `BigInt`
   |
   = note: perhaps two different versions of crate `num_bigint` are being used?
@cuviper
Copy link
Member

cuviper commented Jun 10, 2021

It means your num_bigint dependency version doesn't match the indirect dependency used by your version of num_rational. The compiler treats different versions as completely distinct types. You can run cargo tree to see which is which.

You should make sure both dependencies are updated to their latest version in your Cargo.toml.

@janus
Copy link
Author

janus commented Aug 11, 2021

@cuviper Thanks so much for this command cargo tree. But is there a way to know the number of bits in BigRational?

@cuviper
Copy link
Member

cuviper commented Aug 17, 2021

You can call .numer() and .denom() to access each BigInt part, then call .bits() on those.

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