[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GMP code committed -- watch for bugs.
From: |
Kevin Ryde |
Subject: |
Re: GMP code committed -- watch for bugs. |
Date: |
Thu, 24 Apr 2003 08:40:22 +1000 |
User-agent: |
Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (gnu/linux) |
Rob Browning <address@hidden> writes:
>
> There may well be bugs
In >, < and =, mpz_cmp_d cannot be called with a NaN, that'll need to
be tested explicitly.
The doco doesn't say much about nans, but you can imagine with a
positive/zero/negative return there's no scope to indicate
"unordered".
Also, unfortunately mpz_cmp_d currently doesn't recognise infinities,
so those will need to be checked before making a call too.
The current code ends up treating infinities as 2^1023 or some such
big value, so the problem will only be seen with bignums larger than
that.
I'd been meaning to add infinities to mpz_cmp_d and friends, I'll see
if that can be in gmp 4.2. In which case perhaps a bit of a macro
like below (untested) to hide the difference between the versions,
/* mpz_cmp_d only recognises infinities in gmp 4.2 and up.
For prior versions use an explicit check here. */
#if __GNU_MP_VERSION < 4 \
|| (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 2)
#define guile_mpz_cmp_d(z, d) \
(xisinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d))
#else
#define guile_mpz_cmp_d(z, d) mpz_cmp_d (z, d)
#endif
Re: GMP code committed -- watch for bugs., Mikael Djurfeldt, 2003/04/06
Re: GMP code committed -- watch for bugs., Kevin Ryde, 2003/04/06
Re: GMP code committed -- watch for bugs.,
Kevin Ryde <=