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

Use MPIR for Big* numbers on Windows #11412

Merged

Conversation

HertzDevil
Copy link
Contributor

This PR adds support for the BigInt, BigFloat, BigRational, and BigDecimal types on Windows by using MPIR, an API-compatible fork of GMP. The main benefit is it provides Visual Studio projects, so setup on CI is quite easy compared to GMP's autoconf-based workflow. All existing Big*-related specs pass except for the accuracy loss in BigFloat#** (GMP and MPIR do nothing about this, but MPFR does; see #11410).

Due to the size differences of LibC::Long between Linux 64-bit and Windows 64-bit, GMP probably wouldn't work on the latter even if it successfully compiles. But we don't need to switch to MPIR for the former either, since GMP is readily available there.

spec/std/big/big_float_spec.cr Outdated Show resolved Hide resolved
src/big/lib_gmp.cr Outdated Show resolved Hide resolved
src/big/lib_gmp.cr Outdated Show resolved Hide resolved
@oprypin oprypin self-requested a review November 8, 2021 08:24
Copy link
Member

@oprypin oprypin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, other than the small comments. Thanks!

.github/workflows/win.yml Outdated Show resolved Hide resolved
.github/workflows/win.yml Outdated Show resolved Hide resolved
@straight-shoota straight-shoota merged commit c722e85 into crystal-lang:master Nov 17, 2021
@HertzDevil HertzDevil deleted the feature/windows-big-num branch November 17, 2021 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants