Closed JesseWo closed 2 years ago
Hi @JesseWo which version of the library are you using?
There are several problems with your reproducer test:
java.lang.ArithmeticException: Value cannot be narrowed to float
With that said if you explicitly allow narrowing that loses precision the actual double is as you reported it and I will look into this.
lib version: 0.3.3
In addition, the above unit test can be passed if it is reduced by one digit, e.g. 29514.959839357429718
Thanks for your response!
Hi @JesseWo, I've fixed this issue and the fix will be in build 0.3.6 that is currently rolling out. There was a API change in version 0.3.4 that made doubleValue()
explicitly require that the exact result is returned, unless you specify that you don't need exact result with doubleValue(false)
. The reason why we are now requiring is that a lot of people are unaware of the limitations in IEEE 754 double/float (which java and kotlin use)
A simple example would be to run this and observe it finishes successfully even though the numbers are different:
assertEquals(29514.9598393574297189, 29514.9598393574297194)
Describe the bug
Unit Test:
Output
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Platform
If JS (please complete the following information):
If Smartphone (please complete the following information):
Additional context Add any other context about the problem here.