Re: Discussion about Java Floating Point?

2022-03-15 Thread Bernd Eckenfels
@openjdk.java.net Betreff: Discussion about Java Floating Point? To core-libs-dev@openjdk.java.net, In terms of floating point, it seems there are thus three (3) phenomena that are relevant. 1) Arithmetic on float and double, via operators. 2) Elementary function calls, namely those made from

Re: Discussion about Java Floating Point?

2022-03-15 Thread Martin Desruisseaux
Hello A.Z. As Raffaello said, Java arithmetic does not have any more problem than C/C++ when using IEEE 754. The "proof" of contrary is only an illusion due to the rounding behavior of C/C++ output routines, as demonstrated by Raffaello's code. Maybe some C/C++ code use Intel extended

Re: Discussion about Java Floating Point?

2022-03-15 Thread Raffaello Giulietti
Sorry, for some reason a line was missing in the C++ code #include using namespace std; int main() { cout << "Program has started..." << endl; double a = 0.1D; double b = 0.1D; double c = a*b; double d = 0.01D; cout << endl << "0.1D*0.1D " << (c == d ? "==" : "!=") <<

Re: Discussion about Java Floating Point?

2022-03-15 Thread Raffaello Giulietti
Hi, Java, as well as most implementations of most languages, including C and C++, have adopted the IEEE 754 floating-point standard, first issued in 1985. The standard specifies the formats, the outcome of operators and comparisons up to the last bit. Try out this C/C++ code (I'm on Linux

Discussion about Java Floating Point?

2022-03-14 Thread A Z
To core-libs-dev@openjdk.java.net, In terms of floating point, it seems there are thus three (3) phenomena that are relevant. 1) Arithmetic on float and double, via operators. 2) Elementary function calls, namely those made from java.lang.StrictMath, as it is, on double values. 3)