diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-04-23 23:46:13 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-04-23 23:46:13 +0200 |
commit | ff899db6f668750282a1eb0326341603b3e84c79 (patch) | |
tree | 6daf097ca395729bb07be37a51bdde928844acbf /mpz/cmpabs_d.c | |
parent | 584b78ceee967831c4713026c59b6d5ef2d5c174 (diff) | |
download | gmp-ff899db6f668750282a1eb0326341603b3e84c79.tar.gz |
* mpz/cmp_d.c, mpz/cmpabs_d.c, mpf/cmp_d.c: NaN invalid, Inf bigger
than any value.
Diffstat (limited to 'mpz/cmpabs_d.c')
-rw-r--r-- | mpz/cmpabs_d.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mpz/cmpabs_d.c b/mpz/cmpabs_d.c index de9e95ced..a61fef96f 100644 --- a/mpz/cmpabs_d.c +++ b/mpz/cmpabs_d.c @@ -1,6 +1,6 @@ /* mpz_cmpabs_d -- compare absolute values of mpz and double. -Copyright 2001, 2002 Free Software Foundation, Inc. +Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -17,8 +17,13 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. -*/ +MA 02111-1307, USA. */ + +#include "config.h" + +#if HAVE_FLOAT_H +#include <float.h> /* for DBL_MAX */ +#endif #include "gmp.h" #include "gmp-impl.h" @@ -50,6 +55,10 @@ mpz_cmpabs_d (mpz_srcptr z, double d) mp_size_t zsize; int dexp; + /* d=NaN is an invalid operation, there's no sensible return value. + d=Inf or -Inf is always bigger than z. */ + DOUBLE_NAN_INF_ACTION (d, __gmp_invalid_operation (), return -1); + /* 1. Check for either operand zero. */ zsize = SIZ(z); if (d == 0.0) |