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

wrong precision for floats #59

Open
rschumi0 opened this issue Feb 29, 2020 · 0 comments
Open

wrong precision for floats #59

rschumi0 opened this issue Feb 29, 2020 · 0 comments

Comments

@rschumi0
Copy link

Some of my tests showed that K-Java has a wrong precision for float values. I assume that float values were just encoded as double precision values.
As a result, I could observe that in some calculations, K-Java produces results that significantly diverge from the results of Java. Moreover, K-Java sometimes produces a concrete value, whereas Java returns Infinity, which is shown in the following example:

float a = (float) 1 - 1473150328275393513L / 0.16f * 6854191149854506640L * -128033296 * 23412341234123414L;
System.out.println("" + a); //K-Java shows 1.8916947877681303e+62, Java shows Infinity

double b = (double) 1 - 1473150328275393513L / 0.16 * 6854191149854506640L * -128033296 * 23412341234123414L;
System.out.println("" + b); //K-Java and Java shows 1.8916947877681303e+62

Additionally, I noticed that K-Java wrongly represents the infinity value (e.g. -Infinity.0) of double or float calculations and also the exponent representation is a bit different to Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant