|
|
|
|
|
by isbvhodnvemrwvn
2754 days ago
|
|
Multiplication of floating-point numbers is not associative. Take for instance: <smallest possible positive number> * 0.5 * 2 When evaluated like that: (<SPPN> * 0.5) * 2 the result is 0 * 2 = 0 And when evaluated the other way around: <SPPN> * (0.5 * 2) the result is <SPPN> * 1 = <SPPN> double sppn = Double.MIN_VALUE;
double first = sppn * (0.5 * 2);
double second = (sppn * 0.5) * 2;
System.out.println(sppn);
System.out.println(first);
System.out.println(second);
|
|