1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
usa 2012-08-31 05:34:08 +00:00
parent 470c941ce5
commit 1d1130eea1
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Fri Aug 31 14:32:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* 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]
Fri Aug 31 14:31:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* template/id.h.tmpl, tool/id2token.rb: make id.h independent from

View file

@ -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);