-
Notifications
You must be signed in to change notification settings - Fork 13.3k
add big integers to libstd #11536
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
Comments
I am only interested in doing this if we decide to make big integers the default. Otherwise I think it is appropriate to have them in another crate. In general I would rather not put things in std unless they are vital to the operation of the language. We should instead be encouraging smaller crates and setting that example by doing so in the Rust distribution. |
@brson: Well, my opinion is that there's not a need to define a default, in which case it wouldn't have a place in std. I do think it's important for it to be equal to fixed-size integers or people are going to choose the convenience of ignoring overflow. That's already the culture Rust has created because for fast big integers you need to go out of your way to use |
I don't think we should include big integers in the standard library if it's not a competitive implementation. As the only realistic option is GMP and it isn't viewed as acceptable, I no longer want to do this. |
Since there was a discussion between myself and @thestinger on IRC, it might be useful to summarise my point. If Rust included anything (L)GPL in the stdlib, it would make it unusable for many closed-source software developers. It would effectively kill Rust for game dev and possibly also for iOS/Mac store/Windows Store. I do agree that there should be a low barrier to using bigints. Perhaps the solution is an official (curated) list of libraries that are not necessarily endorsed, but considered of good quality, as @thestinger suggested. Then it would be obvious how to do bigints in Rust (GMP, libtommath or intel's, depending on which license you prefer) without having to include anything in the stdlib. |
I'm unsure about whether a pure Rust implementation or an existing MIT/BSD-licensed big integer library should be used. Even reaching acceptable performance for integers that aren't very large is a big task.
There's no open-source library in the same class as GMP for very large integers. It has increasingly better asymptomatic performance than the alternatives as the numbers get larger and highly optimized assembly routines which are important in this domain.
However, the LGPL license of GMP prevents it from being used by default:
The text was updated successfully, but these errors were encountered: