https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112011-09-05T05:14:30ZRuby Issue Tracking SystemBackport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205762011-09-05T05:14:30Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r33186.<br>
Marc-Andre, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>numeric.c (flo_round): Make Float#round round big values [bug <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Float#round doesn't round big values (Closed)" href="https://redmine.ruby-lang.org/issues/5272">#5272</a>]</li>
</ul> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205772011-09-05T05:17:15Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><p>Opening the backport request. Note: dependent on r33185 and r33183</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205792011-09-05T16:22:46Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul></ul><p>I've found that TestFloat#test_round fails after r33186 on i686-linux.</p>
<p>For (4294967295.8).round, 32bit version ruby returns 4294967295, while 64bit version(x86_64-linux) returns correctly 4294967296. It seems that when result value is Bignum Float#round works like floor().</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205802011-09-05T17:11:53Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/2052">numeric.c.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/2052/numeric.c.patch">numeric.c.patch</a> added</li></ul><p>Attach a tiny patch. It works for me with make test-all.</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205912011-09-06T06:54:39Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>Tomoyuki Chikanaga wrote:</p>
<blockquote>
<p>Attach a tiny patch. It works for me with make test-all.</p>
</blockquote>
<p>Thanks! You patch works, but the bug was actually in dbl2ival. See r33199 / <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: 4294967295.8.round is 4294967295 on 32bit (Closed)" href="https://redmine.ruby-lang.org/issues/5276">#5276</a></p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=205982011-09-06T10:43:00Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Tracker</strong> changed from <i>Backport</i> to <i>Bug</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>marcandre (Marc-Andre Lafortune)</i></li></ul> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206002011-09-06T10:51:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>ruby -v</strong> set to <i>ruby 1.9.4dev (2011-08-05 trunk 32856) [x86_64-darwin11.0.0]</i></li></ul><p>This issue still happends:<br>
Float("2.5e-22").round(22) #=> 2.0e-22aaaaaa</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206012011-09-06T10:51:43Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>ruby -v</strong> changed from <i>ruby 1.9.4dev (2011-08-05 trunk 32856) [x86_64-darwin11.0.0]</i> to <i>ruby 1.9.4dev (2011-09-06 trunk 33199) [x86_64-darwin11.1.0]</i></li></ul> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206062011-09-06T15:04:11Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Open</i></li><li><strong>Assignee</strong> deleted (<del><i>marcandre (Marc-Andre Lafortune)</i></del>)</li></ul><p>Yui NARUSE wrote:</p>
<blockquote>
<p>This issue still happends:<br>
Float("2.5e-22").round(22) #=> 2.0e-22</p>
</blockquote>
<p>This is a different issue, caused by calculation error. I opened issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Float#round returns the wrong floats for higher precision (Closed)" href="https://redmine.ruby-lang.org/issues/5273">#5273</a> to deal with boundary cases like this one. This present issue was not due to approximation but by truncation of any values.</p>
<p>Moving back to backport request</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206072011-09-06T15:04:22Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li></ul> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206382011-09-07T08:09:28Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>If I parsed this thread correctly, this bug is not a regression. therefore it isn't 1.9.3p0 material. I think.</p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=206432011-09-07T12:36:57Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>See my comment on <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: 4294967295.8.round is 4294967295 on 32bit (Closed)" href="https://redmine.ruby-lang.org/issues/5276">#5276</a></p> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=214672011-10-23T16:56:05Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>1.9.3</i></del>)</li></ul> Backport193 - Backport #5272: Float#round doesn't round big valueshttps://redmine.ruby-lang.org/issues/5272?journal_id=224912011-11-30T02:39:37Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This issue was solved with changeset r33898.<br>
Marc-Andre, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>merge revision(s) 33158,33185,33186:</p>
<pre><code>* numeric.c (flo_round): substitute machine dependent magic number.
* numeric.c (flo_round): Make Float#round round big values [bug
#5272]
</code></pre>