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

MPFR: Use 64-bit exponents on Windows? #40661

Open
simonbyrne opened this issue Apr 29, 2021 · 2 comments
Open

MPFR: Use 64-bit exponents on Windows? #40661

simonbyrne opened this issue Apr 29, 2021 · 2 comments
Labels
bignums BigInt and BigFloat external dependencies Involves LLVM, OpenBLAS, or other linked libraries windows Affects only Windows

Comments

@simonbyrne
Copy link
Contributor

simonbyrne commented Apr 29, 2021

By default, the exponent used by MPFR is a Clong, which is only an Int32 on Windows. This occasionally causes subtle differences, e.g. JuliaMath/SpecialFunctions.jl#309

Looking into the code, it appears that there is an _MPFR_EXP_FORMAT macro: setting this to 4 would build it with an exponent of Cintmax_t, which is an Int64 on Windows. There is also a similar _MPFR_PREC_FORMAT macro for the precision size as well, but this is currently limited to Clong

Obviously this would break the ABI, and there doesn't seem to be a way to easily detect the value from the library, so I'm not sure exactly what the implications are here (I guess we could just rename the library to libmpfr64 or something like that).

@simonbyrne simonbyrne added external dependencies Involves LLVM, OpenBLAS, or other linked libraries bignums BigInt and BigFloat labels Apr 29, 2021
@oscardssmith
Copy link
Member

A related issue is that GMP on windows uses a Clong for the number of digits, limiting the maximum number size to 2^32 digits on Windows. In general, it would be good if we could make all the Windows C dependencies not do this.

@simonbyrne
Copy link
Contributor Author

It sounds like that is the plan for GMP 7: https://gmplib.org/list-archives/gmp-discuss/2016-March/005966.html?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bignums BigInt and BigFloat external dependencies Involves LLVM, OpenBLAS, or other linked libraries windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

3 participants