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 #471

Merged
merged 7 commits into from Feb 27, 2012
Merged

Bigint #471

merged 7 commits into from Feb 27, 2012

Conversation

@aviks
Copy link
Member

aviks commented Feb 26, 2012

Initial bigint functionality

Currently uses a small c wrapper to interface to GMP. Which may be removed in the future, but the julia parts will still be useful.

Contains some tests and Makefile changes to include GMP.

@StefanKarpinski

This comment has been minimized.

Copy link

StefanKarpinski commented on 0498a1c Feb 27, 2012

I would do this for comparisons:

cmp(x::BigInt, y::BigInt) = ccall(dlsym(_jl_libgmp_wrapper, :_jl_mpz_cmp),
                                  Int, (Ptr{Void}, Ptr{Void}), x.mpz, y.mpz)

That's an standard function that exists for other types as well. Then you define comparisons more succinctly like this:

==(x::BigInt, y::BigInt) = cmp(x,y) == 0
< (x::BigInt, y::BigInt) = cmp(x,y) <  0
<=(x::BigInt, y::BigInt) = cmp(x,y) <= 0

This comment has been minimized.

Copy link
Owner Author

aviks replied Feb 27, 2012

Makes sense, done!

@ViralBShah
Copy link
Member

ViralBShah commented Feb 27, 2012

@StefanKarpinski It says this pull request can't be automatically merged. Can you handle the merge?

@ViralBShah ViralBShah merged commit 9bdab76 into JuliaLang:master Feb 27, 2012
StefanKarpinski pushed a commit that referenced this pull request Feb 8, 2018
KristofferC added a commit that referenced this pull request Jul 9, 2018
KristofferC added a commit that referenced this pull request Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.