[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [adoptium-wg] Question about Adoptium Java 17 and Floating Point.
|
Hi.
This is not the correct list for such questions, as the working group
only looks after the governance of Adoptium - not the technical work.
The short answer is that Adoptium Temurin builds the unmodified OpenJDK
code that implements the Java language spec. That spec requires floats
and doubles to adhere to IEEE754 behavior, you can use BigDecimal for
arbitrary precision arithmetic...
$ docker run -it eclipse-temurin:17
Nov 19, 2021 10:58:20 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
| Welcome to JShell -- Version 17.0.1
| For an introduction type: /help intro
jshell> 0.1f*0.1f
$1 ==> 0.010000001
jshell> 0.1d*0.1d
$2 ==> 0.010000000000000002
jshell> new BigDecimal("0.1").multiply(new BigDecimal("0.1"))
$3 ==> 0.01
Please direct any follow-ups to the Adoptium Slack channel via
https://adoptium.net/slack.html
or the OpenJDK core-libs mailing list via
https://mail.openjdk.java.net/mailman/listinfo/core-libs-dev
Thanks,
Tim
On 19/11/2021 05:36, A Z wrote:
I would like to know how Adoptium Java performs.
-Is it compatible with Free Open Source Java libraries,
or other Java libraries, out there?
-Has Adoptium removed the phenomenon of Java
Floating Point denormal and pronormal values?
Consider the following Java code snippet:
**//----------------------------------------------------------
package JavaApplication;
import static java.lang.System.*;
public class Start
{
public static void main(String ...args)
{
out.println("Program has started...");
double a = 0.1;
double b = 0.1;
double c = a*b;
out.println();
out.println(c);
out.println();
out.println(c == 0.01);
float d = 0.01F;
float e = 0.01F;
float f = d*e;
out.println();
out.println(f);
out.println();
out.println(f == 0.01);
out.println();
out.println("Program has Finished.");
}}
//----------------------------------------------------------**
-What I need is a version of Java 17 that has the same
free-for-all-use license model as OpenJDK17, but has
removed the phenomenon of denormal and pronormal
values, of all defaulting arithmetic, systematically,
involving float and double, and their objects.
-Will Adoptium run the included code fragment,
outputting the generally expected results,
printing true and not false?
_______________________________________________
adoptium-wg mailing list
adoptium-wg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/adoptium-wg