summaryrefslogtreecommitdiff
path: root/insert-dbl.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1997-07-25 17:31:31 +0200
committertege <tege@gmplib.org>1997-07-25 17:31:31 +0200
commitf62db216da87d65309d861823049f0f3c242b91f (patch)
treeac56d8ef59b429af055561e246a1d9f3c77dccc8 /insert-dbl.c
parentcedcea4e49439d170bacf25add0f2fb2ecc47fd0 (diff)
downloadgmp-f62db216da87d65309d861823049f0f3c242b91f.tar.gz
Check for exponent overflow and return Inf.
Diffstat (limited to 'insert-dbl.c')
-rw-r--r--insert-dbl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/insert-dbl.c b/insert-dbl.c
index b0b0747e9..c63eaa557 100644
--- a/insert-dbl.c
+++ b/insert-dbl.c
@@ -43,7 +43,13 @@ __gmp_scale2 (d, exp)
{
union ieee_double_extract x;
x.d = d;
- x.s.exp += exp;
+ exp += x.s.exp;
+ x.s.exp = exp;
+ if (exp >= 2048)
+ {
+ x.s.exp = 2047;
+ x.s.manl = x.s.manh = 0;
+ }
return x.d;
}
#else