----- Original Message -----
> From: "A Z" <[email protected]>
> To: "core-libs-dev" <[email protected]>
> Sent: Monday, March 14, 2022 7:49:04 AM
> Subject: Questions about enhancement and Correction to Java OpenJDK Floating
> Point?
Hi Terry,
if you want to have the same output as C, instead of println() use printf().
In your example, using
out.printf("%f\n", c);
prints
0.010000
0.010000
regards,
Rémi
> To whom it may concern,
>
> Having noticed
>
> https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8190947
> https://bugs.openjdk.java.net/browse/JDK-8190991
>
> and similar, at
> https://community.oracle.com/tech/developers/discussion/4126262/big-issue-with-float-double-java-floating-point
>
> I have been referred on to the core-libs-dev area.
>
> The software development company I represent wishes to keep its name
> confidential,
> and no-mentioned, at this time.
>
> A number of us at our end have found that floating point and StrictMath
> arithmetic
> on both float and double does not result in range accuracy, but produces
> denormal
> and pronormal values.
>
> We are aware of the Java Language Specification, and IEEE 754 specifications,
> to these issues, but are still finding that they are not the most relevant or
> great issue.
>
> While we are aware of the BigDecimal and BigInteger workarounds, and
> furthermore, the calculator class including big-math
> https://github.com/eobermuhlner,
> we are finding in the development, debugging, and editing of our Java
> programs,
> that using other classes to operate and exchange for the lack of range
> accuracy
> from float,
> double and java.lang.StrictMath, that we are getting bogged down with what
> turns
> into
> more inferior software. The known and available workaround approaches are
> becoming
> stop-gap measures, perforcedly put in place, while introducing other problems
> into OpenJDK or Java software that don't have any particular, immediate,
> solutions.
>
> Substituting float and double data in and out of BigDecimal and BigInteger
> produces
> source code which is much messier, complicated, error prone, difficult to
> understand
> and to change, is definitely slower, and is an inferior substitute when float
> and double are more than enough in the overwhelming majority of corresponding
> cases.
> This is particularly showing up in 2D and 3D Graphics software, by the default
> OpenJDK Libraries, but also through JMonkeyEngine 3.5.
>
> Possessing the option to immediately deal with the precondition, postcondition
> and field types of float and double is far superior and more than ideal.
> All this is before the massive advantage of being able to use operators,
> but the change case becomes overwhelming when along a range accurate,
> double (or maybe float, also) supporting Scientific Calculator class.
>
> If I want to discuss (at least OpenJDK) change in this area, I have
> been pointed to the core-libs area, by one of the respondents
> of the article:
>
> https://community.oracle.com/tech/developers/discussion/4126262/big-issue-with-float-double-java-floating-point.
>
> Is there anyone here, at core-libs-dev, who can point
> me in a better Oracle or OpenJDK direction, to discuss further
> and see about Java float and double and StrictMath floating point
> arithmetic denormal and pronormal values being repaired away
> and being made range accurate for all evaluation operations
> with them?
>
> Certainly since other languages already have, that are open source
> and open resource file ones. It is a mathematical fact that, for
> consistent, necessary and even fast term, 10% of 10% must
> always precisely be 1%, and by no means anything else.
>
> Consider these three different language API evaluations,
> using their equivalents of float and double to perform
> the floating point equivalent of that precise evaluation:
>
> //----------------------------------------------------------
> //The C Language.
> #include <stdio.h>
>
> int main()
> {
> printf("Program has started...");
> printf("\n");
> printf("\n");
> double a = 0.1D;
> double b = 0.1D;
> double c = a*b;
> printf("%lf",c);
> printf("\n");
> printf("\n");
> float d = 0.1F;
> float e = 0.1F;
> float f = d*e;
> printf("%lf",f);
> printf("\n");
> printf("\n");
> printf("Program has Finished.");
> return 0;
> }
>
> /*
> Program has started...
>
> 0.010000
>
> 0.010000
>
> Program has Finished.
> */
> //----------------------------------------------------------
> //The C++ Language.
>
> #include <iostream>
>
> using namespace std;
>
> int main()
> {
> cout << "Program has started..." << endl;
> double a = 0.1D;
> double b = 0.1D;
> double c = a*b;
> cout << endl << c << endl << endl;
> float d = 0.1F;
> float e = 0.1F;
> float f = d*e;
> cout << f << endl << endl;
> cout << "Program has Finished.";
> return 0;
> }
>
> /*
> Program has started...
>
> 0.01
>
> 0.01
>
> Program has Finished.
> */
>
> //----------------------------------------------------------
> //The Java Language.
>
> import static java.lang.System.*;
> public class Start
> {
> public static void main(String ... args)
> {
> out.println("Program has started...");
> double a = 0.1D;
> double b = 0.1D;
> double c = a*b;
> out.println();
> out.println(c);
> float d = 0.1F;
> float e = 0.1F;
> float f = d*e;
> out.println();
> out.println(f); out.println();
> out.println("Program has Finished.");
> }}
>
> /*
> Program has started...
>
> 0.010000000000000002
>
> 0.010000001
>
> Program has Finished..
> */
> //----------------------------------------------------------
>
> In order for java to introduce either default alteration,
> or a compatibility mode alteration, where,
> how and who should I begin to speak with?
>
> Yours Sincerely,
>
> Terry Neale