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

Drop requirement for ArithmeticException on non-terminating decimal expansion #98

Open
marschall opened this issue Sep 5, 2018 · 0 comments
Labels

Comments

@marschall
Copy link
Member

All three divide methods on MonetaryAmount (MonetaryAmount#divide(double), MonetaryAmount#divide(long), MonetaryAmount#divide(Number)) currently require

Throws:
ArithmeticException - if the exact quotient does not have a terminating decimal expansion

We have a MonetaryAmount implementation that is based on a fraction that can handle numbers that do not have a terminating decimal expansion. Strictly the specification requires us to throw a ArithmeticException even though we can handle the result.

If possible we would like to see this requirement removed. We believe the already existing requirement

Throws:
ArithmeticException - ... or if the result exceeds the numeric capabilities of this implementation class

Is enough to cause implementations that can not handle numbers that do not have a terminating decimal expansion to throw a ArithmeticException.

@keilw keilw added the analysis label Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants