summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 398d963aea..123eca7403 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1233,7 +1233,10 @@ rb_big2dbl(VALUE x)
if (isinf(d)) {
rb_warning("Bignum out of Float range");
- d = HUGE_VAL;
+ if (signbit(d))
+ d = -HUGE_VAL;
+ else
+ d = HUGE_VAL;
}
return d;
}