From 55e155a8755dd869bb2d7a80cb0e75ace8cf75da Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 23 Apr 2003 23:43:47 +0200 Subject: * mpz/set_d.c, mpq/set_d.c, mpf/set_d.c: Nan or Inf invalid. --- mpz/set_d.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mpz') diff --git a/mpz/set_d.c b/mpz/set_d.c index 0ec74e24a..07b6ef83d 100644 --- a/mpz/set_d.c +++ b/mpz/set_d.c @@ -1,6 +1,6 @@ /* mpz_set_d(integer, val) -- Assign INTEGER with a double value VAL. -Copyright 1995, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1995, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,6 +19,12 @@ 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. */ +#include "config.h" + +#if HAVE_FLOAT_H +#include /* for DBL_MAX */ +#endif + #include "gmp.h" #include "gmp-impl.h" @@ -30,6 +36,10 @@ mpz_set_d (mpz_ptr r, double d) mp_ptr rp; mp_size_t rn; + DOUBLE_NAN_INF_ACTION (d, + __gmp_invalid_operation (), + __gmp_invalid_operation ()); + negative = d < 0; d = ABS (d); -- cgit v1.2.1