Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise warning on using default Money.rounding_mode #883

Merged
merged 1 commit into from
Jul 14, 2019

Conversation

antstorm
Copy link
Contributor

The default Money.rounding_mode will change to ROUND_HALF_UP in v7. Warning everyone ahead of time to minimise potential impact

@coveralls
Copy link

coveralls commented Jul 14, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling be42bfa on antstorm:default-rounding-mode-warning into 6be1cfb on RubyMoney:master.

@antstorm antstorm merged commit 8754d9a into RubyMoney:master Jul 14, 2019
@antstorm antstorm deleted the default-rounding-mode-warning branch July 14, 2019 22:06
@wholien
Copy link

wholien commented Dec 5, 2019

@antstorm - just curious, why change the default rounding_mode ?

@antstorm
Copy link
Contributor Author

antstorm commented Dec 7, 2019

@wholien the default rounding mode is ROUND_HALF_EVEN and they way it works might not be expected by people using this gem. It works best when aggregating with bigger amount of data and has an effect of minimizing rounding error, however when dealing with one off cases (for example rounding the result of a currency exchange) it's probably not as useful.

kennyadsl added a commit to nebulab/solidus that referenced this pull request Dec 10, 2019
This is the current default value, but it will change in
the Money gem in some future release (v7).

People can start adhering to that value by setting

Money.rounding_mode = BigDecimal::ROUND_HALF_UP

in their own application. For now, this is what we used so far
and we should not change it for existing applications.

Ref: RubyMoney/money#883
@wholien
Copy link

wholien commented Dec 12, 2019

@antstorm appreciate the explanation.

jrafanie added a commit to jrafanie/money that referenced this pull request Jan 2, 2020
Currency:  from USD to nil
Rounding:  from ROUND_HALF_EVEN to ROUND_HALF_UP

The warnings were added in RubyMoney#882 and RubyMoney#883 and refined in RubyMoney#902.
antstorm pushed a commit that referenced this pull request Jan 2, 2020
Currency:  from USD to nil
Rounding:  from ROUND_HALF_EVEN to ROUND_HALF_UP

The warnings were added in #882 and #883 and refined in #902.
jiz4oh pushed a commit to castlery/solidus that referenced this pull request Apr 15, 2022
This is the current default value, but it will change in
the Money gem in some future release (v7).

People can start adhering to that value by setting

Money.rounding_mode = BigDecimal::ROUND_HALF_UP

in their own application. For now, this is what we used so far
and we should not change it for existing applications.

Ref: RubyMoney/money#883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants