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

Accuracy loss due to limited data type #6

Open
6 tasks done
Aga-C opened this issue Jan 2, 2024 · 0 comments
Open
6 tasks done

Accuracy loss due to limited data type #6

Aga-C opened this issue Jan 2, 2024 · 0 comments
Labels
bug Something is not working

Comments

@Aga-C
Copy link
Member

Aga-C commented Jan 2, 2024

Checklist

  • I can reproduce the bug with the latest version.
  • I made sure that there are no existing issues - open or closed - to which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Describe the bug
App relies on exp4j to perform calculations, which is based on Double data type. It's a floating-point data type, which causes accuracy loss, especially with very long inputs.

I see two possible solutions:

  1. Stop relying on exp4j for calculations (especially that app doesn't utilize its most powerful feature - preserving operation order) and rewrite the app to use BigDecimal instead Double.
  2. Add validation to input, which would stop users from inputting numbers too large to be handled by Double type. However, it won't guarantee that user won't run in the same problem during calculations.

To Reproduce
Steps to reproduce the behavior:

  1. Open the app.
  2. Tap any digit (despite 0) circa 20 times.

Result: At some point, instead of the digit I input, 0 is added.

Another case:

  1. Open the app.
  2. Tap decimal separator and then 9 over 13 times.

Result: At some point, the integer part of the number starts incrementing by one with each new decimal digit.

Expected behavior
I should see the number I've typed.

Device info (please complete the following information):

  • Model: OnePlus 9 Pro
  • OS: Android 13
  • Version Simple Calculator 5.12.0
@Aga-C Aga-C added the bug Something is not working label Jan 2, 2024
@Aga-C Aga-C mentioned this issue Jan 2, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

1 participant