Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by
closed by

Not really a Clojure problem, but just FYI... I'm using an Azul Java 8 on my M1 MacBook Air.


It turns out that java.lang.Math/exp isn't exactly right on this JVM. In particular, the build log says:

[java] FAIL in (test-exp) (math.clj:74)
[java] expected: (= m/E (m/exp 1))
[java]   actual: (not (= 2.718281828459045 2.7182818284590455))

It looks like it's off in the last bit of the double. I'm using Azul because it claims to be ARM native on the M1, but there may be a complication with the M1 running some Intel binaries in emulation under the hood. Not sure what's really going on, but I thought I should mention the inconsistency in case someone else runs into it. I assume the problem is a bug with the Azul JVM. I will try to follow up with them if I can figure out the proper channel.

By the way, is there a better ARM Java to use on an M1 Mac?

Here are some of my System/getProperties results:

"jdk.vendor.version" "Zulu",
"sun.management.compiler" "HotSpot 64-Bit Tiered Compilers",
"java.vm.info" "mixed mode",
"java.vendor.url" "http://www.azul.com/",
"java.vm.version" "25.312-b07",
"java.vendor" "Azul Systems, Inc.",
"java.vm.specification.version" "1.8",
"java.runtime.version" "1.8.0_312-b07",
"java.vm.vendor" "Azul Systems, Inc.",
"java.vm.name" "OpenJDK 64-Bit Server VM",
"java.version" "1.8.0_312",
"os.arch" "aarch64",
"java.specification.version" "1.8",
"sun.arch.data.model" "64",
"java.class.version" "52.0",
"os.name" "Mac OS X",
"os.version" "12.1"

closed with the note: Released in 1.11.0-beta1

2 Answers

0 votes
selected by
Best answer

That level of imprecision (1 ulp) is allowed in the Math impl (StrictMath is different), so this is ok but it would be good for the test to be tolerant enough to pass.

Thanks for the information about the acceptable ulp tolerance.  As a quick hack, I changed the test to cast to float before comparing.  That allows the build to succeed with Azul.
0 votes

Logged as https://clojure.atlassian.net/browse/CLJ-2689 and added a patch if you want to try that out.