[ruby-core:78430] [Ruby trunk Bug#12958] Breaking change in how `#round` works

From: jerome.cornet@...
Date: 2016-11-30 02:43:18 UTC
List: ruby-core #78430
Issue #12958 has been updated by Jerome Cornet.


> Am I making myself understood?  I am distinguishing Floats and BigDecimals.  We did not change how a BigDecimal rounds.  Money related calculations should use that class instead.  Not Float.  Using Float for money is in fact toxic; for instance you can't express $0.1 using Float.

Oh I'm sorry, my bad, I thought the change changed rounding for everything, not just Float (I misread the initial change, and agreed, floats are toxic for money)

But does this mean that Float rounds in a different way as BigDecimal by default then ?
So the patch made Float rounding consistent with sprintf rouding, but by doing so it made default Float rounding inconsistent with default BigDecimal rounding. 
Is my understanding correct ?

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

* 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>

In This Thread

Prev Next