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

[Ecommerce] Default rounding mode for decimals to PHP_ROUND_HALF_UP #3738

Open
BlackbitNeueMedien opened this Issue Dec 11, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@BlackbitNeueMedien
Copy link
Contributor

BlackbitNeueMedien commented Dec 11, 2018

I am curious as to why round to even was chosen as the default rounding method in this ecommerce context. Would it not make sense to replace it with PHP_ROUND_HALF_UP in the Decimal class instead?

In the following scenario, the prices shown to the customer to not line up because the 0.5 cents are rounded down in the discount and in the grant total:
Subtotal: 19.45
Discount 10%: 1.94
Total: 17.50

@BlackbitNeueMedien

This comment has been minimized.

Copy link
Contributor

BlackbitNeueMedien commented Dec 11, 2018

Well, nevermind. That wouldn't really change anything in my case, would it?
But should it not be changed nonetheless?

@fashxp

This comment has been minimized.

Copy link
Member

fashxp commented Dec 14, 2018

a good question.
but in your case, if you are using a scale of 4 (which is default), there should be no rounding taking place.
is that your actual result of the calculations?

@fashxp fashxp changed the title [Ecommerce] Default rounding mode for decimals [Ecommerce] Default rounding mode for decimals to PHP_ROUND_HALF_UP Dec 14, 2018

@fashxp

This comment has been minimized.

Copy link
Member

fashxp commented Dec 14, 2018

it think we should change it to PHP_ROUND_HALF_UP ... but I'm not sure if we should add it to 5.6? What do you think?

@fashxp fashxp self-assigned this Dec 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment