From: Marc-Andre Lafortune Date: 2011-09-06T15:04:12+09:00 Subject: [ruby-core:39296] [Ruby 1.9 - Bug #5272][Open] Float#round doesn't round big values Issue #5272 has been updated by Marc-Andre Lafortune. Category set to core Status changed from Assigned to Open Assignee deleted (Marc-Andre Lafortune) Yui NARUSE wrote: > This issue still happends: > Float("2.5e-22").round(22) #=> 2.0e-22 This is a different issue, caused by calculation error. I opened issue #5273 to deal with boundary cases like this one. This present issue was not due to approximation but by truncation of any values. Moving back to backport request ---------------------------------------- Bug #5272: Float#round doesn't round big values http://redmine.ruby-lang.org/issues/5272 Author: Marc-Andre Lafortune Status: Open Priority: Normal Assignee: Category: core Target version: 1.9.3 ruby -v: ruby 1.9.4dev (2011-09-06 trunk 33199) [x86_64-darwin11.1.0] For large enough values (outside of Fixnum range), Float#round does not round at all but simply truncates: 2.999999999999999e20.round(-20) # => 200000000000000000000 Fixed in trunk, but would be nice to backport for Ruby 1.9.3. -- http://redmine.ruby-lang.org