ruby-changes:24814
From: usa <ko1@a...>
Date: Fri, 31 Aug 2012 14:34:22 +0900 (JST)
Subject: [ruby-changes:24814] usa:r36865 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
usa 2012-08-31 14:34:08 +0900 (Fri, 31 Aug 2012) New Revision: 36865 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36865 Log: * 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] Modified files: trunk/ChangeLog trunk/ext/bigdecimal/bigdecimal.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36864) +++ ChangeLog (revision 36865) @@ -1,3 +1,9 @@ +Fri Aug 31 14:32:05 2012 NAKAMURA Usaku <usa@r...> + + * 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@r...> * template/id.h.tmpl, tool/id2token.rb: make id.h independent from Index: ext/bigdecimal/bigdecimal.c =================================================================== --- ext/bigdecimal/bigdecimal.c (revision 36864) +++ ext/bigdecimal/bigdecimal.c (revision 36865) @@ -704,14 +704,14 @@ 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/