Issue #12958 has been updated by Shyouhei Urabe.


Jerome Cornet wrote:
> Shyouhei Urabe wrote:
> > As far as I can see the Rails breakage only happens in views, where 30secs is shown "less than a minute" instead of "1 minute".  That sounds very trivial to me.   And yet, did not break silently.
> 
> Actually, any money-related calculation (penny rounding) would now be silently changing behavior, leading to weird questions as to why the math doesn't add up to the penny.

The new default is called the "banker's round" for reasons.  Money related people should prefer this.  And to say frankly, using Floats for money-related calculation is the source of weirdness.

> While consistency is a good thing, I'm not sure why we can't make the default the old behavior, and change sprintf to explicitly call the new behavior.

sprintf has no option field to specify tie-breaking mode.  You can't but change round instead.


----------------------------------------
Bug #12958: Breaking change in how `#round` works
https://bugs.ruby-lang.org/issues/12958#change-61799

* Author: Rafael Fran├ža
* Status: Assigned
* Priority: Normal
* Assignee: Kenta Murata
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
We noticed in the Rails test suite that there is a breaking change in how `#round` works between 2.3 and 2.4

https://github.com/rails/rails/pull/27091

Is that desirable?

I think it is may cause a lot of problem if the behavior of `#round` without any arguments changes between a minor version.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>