简体   繁体   中英

MPFR max integer value

Do mpfr_t types have a limit on the largest integer value they can store or is the integer component effectively unlimited (only limited by memory limits on the target machine) like mpz_t types are?

If so is there an easy way to detect overflow whilst parsing a value?

You can represent larger integers than what mpz_t can thanks to the exponent, but you may want to extend the exponent range with mpfr_set_emax , so that the maximum representable integer will be almost 2^(2^62−1) on a 64-bit platform. That said, you will not be able to represent all integers exactly since some integers (in particular the odd ones) would require too much precision. Concerning the limit on the precision, the theoretical limit in MPFR is MPFR_PREC_MAX , which is huge on 64-bit platforms. But in practice, you'll first hit either the limit from the amount of memory or the limit of 2^37 bits on the mpz_t size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM