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

[BUG] integer division by zero #2

Open
tommens opened this issue Dec 28, 2023 · 0 comments
Open

[BUG] integer division by zero #2

tommens opened this issue Dec 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tommens
Copy link
Collaborator

tommens commented Dec 28, 2023

Describe the bug
Division by zero is not supported by the current implementation.

To Reproduce
When compute an arithmetic operation Divides composed of two numbers MyNumber(8) and MyNumber(0),
then computing the value of this number with method computes() returns an
java.lang.ArithmeticException: / by zero

Expected behavior
When trying to divide by a 0 integer, the error should be properly handled (using the Java exception handling mechanism for example), for example to return NaN (or something similar), rather then leading to an exception at runtime.

Tests needed
Unit tests ad BDD tests also need to be added to detect this bug and to ensure that it will not reappear somewhere in the future.

Additional context
When extending the calculator to more general number domains and other arithmetic operations, please be beware of similar restrictions that may apply (in the appropriate number domain), such as logarithms of negative values, which cannot exist in the real number set; but can exist in the complex number set.

@tommens tommens added the bug Something isn't working label Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant