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

remove 15 interval RoundCash #166

Merged
merged 3 commits into from
Feb 26, 2020
Merged

remove 15 interval RoundCash #166

merged 3 commits into from
Feb 26, 2020

Conversation

njason
Copy link
Member

@njason njason commented Feb 16, 2020

Addresses: #89

Original PR: #66

Not sure why 15 interval was included in the original PR as there is no information online about it. @SchumacherFM could you explain?

@njason njason requested a review from mwoss February 16, 2020 04:23
@SchumacherFM
Copy link
Contributor

@njason This is mentioned in the description of the pull request. To recite it:

10:  10 cent rounding 3.45 => 3.50 (5 gets rounded up)
15:  10 cent rounding 3.45 => 3.40 (5 gets rounded down)

Why do you want to remove it?

@mwoss
Copy link
Member

mwoss commented Feb 18, 2020

Firstly, RoundCash code returns incorrect values for interval = 15. We could dig in and fix it, but there is no point in doing that. I don't see any use case for such an interval. I've looked through dozens of wiki pages and other websites and I couldn't find any info about it.
Secondly, there was no real explanation of including 15 rounding interval at all.
15: 10 cent rounding 3.45 => 3.40 (5 gets rounded down) is not an explanation, imo.
From your example it looks like interval.= 15 should be used when we want round decimal to 10s, but the rounding result needs to be rounded down.
Rounding down/up logic could be useful, but it should be implemented as an additional parameter to the method signature, not as interval.

@SchumacherFM
Copy link
Contributor

Thank you for the explanation. Approved ;-)

The PR should not only remove the code but also the comments indicating the 15 interval.

Copy link
Member

@mwoss mwoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comments about interval = 15 from TestDecimal_RoundCash_Panic test too

@njason njason merged commit 6c07c6c into master Feb 26, 2020
@njason njason deleted the remove-15 branch February 26, 2020 00:44
fairyhunter13 added a commit to fairyhunter13/decimal that referenced this pull request Jul 12, 2020
* remove 15 interval RoundCash

* update function doc

* Remove comments and benchmark referring interval 15

Co-authored-by: Mateusz Woś <wos.mateusz16@gmail.com>
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