mpir icon indicating copy to clipboard operation
mpir copied to clipboard

Why is there a mpf_set_z function but not mpf_get_z function?

Open SanderBouwhuis opened this issue 6 years ago • 4 comments

I would like to be able to convert from mpz_t to mpf_t and back. How do I do that?

MPZ_T to MPF_T : mpf_set_z (WORKS) MPF_T to MPZ_T : ?mpz_set_f? (DOESN'T WORK)

Why is there a mpf_set_z function but not mpz_get_f function?

Alternatively, why are there no mpf_get_z and mpz_get_f functions?

I guess I could convert the int/float to a string and then convert it to float/int, but that just seems ridiculously bad for performance.

SanderBouwhuis avatar Feb 06 '19 10:02 SanderBouwhuis

The development of the mpf interface was discontinued due to the development of the MPFR package:

https://www.mpfr.org/

We recommend you use that instead. There is no value in duplicating their effort in the MPIR project.

wbhart avatar Feb 06 '19 10:02 wbhart

I use MPIR from Brian Gladman because it works on Windows. MPFR doesn't seem to work on Windows (out of the box)?

Are there bugs in mpf_t? Should I be worried?

SanderBouwhuis avatar Feb 06 '19 12:02 SanderBouwhuis

I'm not aware of bugs, but it is very slow compared to MPFR.

Brian Gladman also supports MPFR on Windows.

wbhart avatar Feb 06 '19 12:02 wbhart

Aha, ok. Quite unfortunate that it's yet another thing that requires effort compiling/integrating and such. I think for now I'll have to stick with MPIR because of time constraints.

Thanks for the info.

SanderBouwhuis avatar Feb 06 '19 16:02 SanderBouwhuis