summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2003-04-23 23:43:47 +0200
committerKevin Ryde <user42@zip.com.au>2003-04-23 23:43:47 +0200
commit55e155a8755dd869bb2d7a80cb0e75ace8cf75da (patch)
tree93f26ee754de72ba99b5b29ef26bd78f53533214 /mpz
parentcf900ae3fb8f8bd2bafa39bf4ad09922bdeef7a2 (diff)
downloadgmp-55e155a8755dd869bb2d7a80cb0e75ace8cf75da.tar.gz
* mpz/set_d.c, mpq/set_d.c, mpf/set_d.c: Nan or Inf invalid.
Diffstat (limited to 'mpz')
-rw-r--r--mpz/set_d.c12
1 files changed, 11 insertions, 1 deletions
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 <float.h> /* 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);