MPF fits in 64bit double?

Richard Damon Richard at Damon-Family.org
Thu Apr 27 23:53:19 CEST 2023


On 4/27/23 11:17 AM, Julien D Arques wrote:
> Hi,
>
> In my algorithm, I need to repeat some calculations up to the point the mpf
> result fits in a double (8bytes on x86_64) without loss.
>
> I plan to use the mpf_fits_ulong_p function because it is 8 bytes as well,
> even if not a double.
> It would warrant that 64bits (and no more) are in use to store the current
> result.
>
> Is it a problematic reasoning?
>
> Thanks,

8 byte doubles don't have 64 bits of precision, because some are used 
for the exponent.

A standard "Double" has 52 bits stored of significant digits + 1 assumed 
leading 1, + a sign bit + 11 bits for the exponent stored with an offset.

-- 
Richard Damon



More information about the gmp-discuss mailing list