mini-gmp mpz_{get,set}_d not fully compatible with GMP

Marco Bodrato bodrato at mail.dm.unipi.it
Fri Mar 16 21:03:06 UTC 2018


Ciao,

Il Mer, 14 Marzo 2018 7:10 pm, Niels Möller ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

>> #if defined(USE_FLOAT_H)
>>  #include <float.h>
>> #endif
>
> This won't work well for mini-gmp.

My idea was, if mini-gmp is used "as-is", it supports IEEE doubles.
If some other double format is needed, the user needs to define
USE_FLOAT_H, if it exists for the target arch, or define
GMP_BITS_PER_DOUBLE with the required number of bits.

>> #if defined(DBL_MANT_DIG) && FLT_RADIX == 2
>>  #define GMP_BITS_PER_DOUBLE DBL_MANT_DIG
>> #endif
>>
>> #if !defined(GMP_BITS_PER_DOUBLE)
>>  #define GMP_BITS_PER_DOUBLE (53)
>> #endif

> [...] for float.h, I think we could use it unconditionally
> also in gmp.
>
> Patch below.

It looks correct to me. float.h was defined by C99, right? One year ago we
thought about requiring at least C99... This is a step towards that
direction.

Ĝis,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list