Assume the following class:
class Test {
public static void main(String[] args) {
double result = Math.log(9) / Math.log(3);
System.out.println(result);
}
};
On a x86_86 Linux machine (Linux 6.8.10-300.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 17 21:20:54 UTC 2024 x86_64 GNU/Linux
), I get the following result:
2.0
On an M3 Mac, I get the following instead:
2.0000000000000004
What are possible explanations of this behavior, other than a JDK bug?
The JDK version used on both machines is Temurin-21.0.3+9
.