summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-31 05:34:08 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-31 05:34:08 +0000
commit1d1130eea1c47da679ac423ccfcb1a9bcec1c937 (patch)
treeafabffee7a83f99a1c5ae77d597b5e81c811dac2 /ext
parent470c941ce5bd1800fc24f271c6234cee096fd592 (diff)
downloadruby-1d1130eea1c47da679ac423ccfcb1a9bcec1c937.tar.gz
* ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
determine 0.0 and Inf's sign instead of internal double value's. Reported by phasis68 (Heesob Park) at [ruby-core:47381] [Bug #6955] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index e8ba40a531..e798781b67 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -704,14 +704,14 @@ BigDecimal_to_f(VALUE self)
overflow:
VpException(VP_EXCEPTION_OVERFLOW, "BigDecimal to Float conversion", 0);
- if (d > 0.0)
+ if (p->sign >= 0)
return rb_float_new(VpGetDoublePosInf());
else
return rb_float_new(VpGetDoubleNegInf());
underflow:
VpException(VP_EXCEPTION_UNDERFLOW, "BigDecimal to Float conversion", 0);
- if (d > 0.0)
+ if (p->sign >= 0)
return rb_float_new(0.0);
else
return rb_float_new(-0.0);