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

Marco Bodrato bodrato at mail.dm.unipi.it
Sun May 20 10:22:51 UTC 2018


Ciao,

Il Sab, 19 Maggio 2018 11:16 pm, Niels Möller ha scritto:
> "Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
>
>> diff -r 41e50c4fdc46 bootstrap.c

>> +#define DONT_USE_FLOAT_H 1
>>  #include "mini-gmp/mini-gmp.c"

>> diff -r 41e50c4fdc46 mini-gmp/mini-gmp.c

>> +#if !defined(DONT_USE_FLOAT_H)
>> +#include <float.h>
>> +#endif

> Makes sense to me, provided that the define also excludes whatever
> mini-gmp functions depend on float.h (which would be get_d and set_d,

float.h is only used for

+#if defined(DBL_MANT_DIG) && FLT_RADIX == 2
+#define GMP_DBL_MANT_BITS DBL_MANT_DIG
+#else
+#define GMP_DBL_MANT_BITS (53)
+#endif

This constant is used only by the new version of get_d, to convert the
correct number of bits and avoid rounding.
I mean, the functions do not "depend on" float.h , and we don't need to
exclude them. Maybe we should decide for a different default value...

Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list