summaryrefslogtreecommitdiff
path: root/mpz/set_d.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2006-05-31 16:50:11 +0200
committertege <tege@gmplib.org>2006-05-31 16:50:11 +0200
commit332ac8bf0ee1c1351d9bd0ae417211e2b64ec543 (patch)
tree83fb463213b1ac29d8958cbc761d39fcbf9ff005 /mpz/set_d.c
parent53a0994622102c90f30bc5241d24da7b892c2f96 (diff)
downloadgmp-332ac8bf0ee1c1351d9bd0ae417211e2b64ec543.tar.gz
Handle negative return values from __gmp_extract_double.
Diffstat (limited to 'mpz/set_d.c')
-rw-r--r--mpz/set_d.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mpz/set_d.c b/mpz/set_d.c
index 2a9cf4232..7385ed1e7 100644
--- a/mpz/set_d.c
+++ b/mpz/set_d.c
@@ -1,6 +1,7 @@
/* mpz_set_d(integer, val) -- Assign INTEGER with a double value VAL.
-Copyright 1995, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2000, 2001, 2002, 2003, 2006 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -56,6 +57,9 @@ mpz_set_d (mpz_ptr r, double d)
if (ALLOC(r) < rn)
_mpz_realloc (r, rn);
+ if (rn <= 0)
+ rn = 0;
+
rp = PTR (r);
switch (rn)