[ruby-core:78083] [Ruby trunk Bug#12580][Closed] Difference in sprintf float rounding
From:
shyouhei@...
Date:
2016-11-11 15:09:29 UTC
List:
ruby-core #78083
Issue #12580 has been updated by Shyouhei Urabe. Status changed from Feedback to Closed OK, closing as per request. ---------------------------------------- Bug #12580: Difference in sprintf float rounding https://bugs.ruby-lang.org/issues/12580#change-61434 * Author: Vipul Amler * Status: Closed * Priority: Normal * Assignee: * ruby -v: ruby 2.4.0dev (2016-07-10 trunk 55628) [x86_64-darwin15] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- on 2.4-dev ` irb(main):006:0> sprintf "%0.01f", 5.55 => "5.6" irb(main):007:0> 5.55.class => Float ` on 2.4-preview `irb(main):001:0> sprintf "%0.01f", 5.55 => "5.5" irb(main):002:0> 5.55.class => Float irb(main):003:0>` Is the change intentional? If yes, what prompted this rounding change? This is currently causing issues on iso8601 serializer on Rails https://github.com/rails/rails/blob/04c512da1247a54474cfd8bef17a9e9019c34004/activesupport/lib/active_support/duration/iso8601_serializer.rb#L25 -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>