Created
April 30, 2017 15:43
-
-
Save Vaguery/93163c1736d2b1aff3cefdd6c4a98b9b to your computer and use it in GitHub Desktop.
Reproducing the Java/ARMv8 `Math/log` bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# intended to be run on an ARMv8 machine at packet.net | |
apt-get update | |
apt-get install default-jre | |
apt-get install wget | |
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein | |
chmod +x lein | |
mv lein /usr/local/bin | |
lein repl | |
# hit ENTER to get past root login warning | |
# ... lein downloads scads of stuff | |
# type the following into lein repl prompts, a line at a time: | |
(def arg (* 2 Math/E)) ;; defines a constant | |
(Math/log arg) ;; returns the ln(2e) | |
;; on Intel machines running Oracle JDK 8, that result is 1.6931471805599452 | |
(assert (= (Math/log arg) 1.6931471805599452)) ;; fails, because on ARMv8 it doesn't equal that |
OK, thanks for the writeup.
The test matrix seems to be
- Oracle JDK 8 vs OpenJDK 7,8,9 (4 possibilities)
- Intel vs ARMv8 (2 possibilities)
that's "only" 8, and it occurs to me that this might be entirely the sort of thing that Docker is good for. Make 8 Dockerfiles, build each of them, compare the results.
I've seen similar exceptional behavior in Go on just the exp() call so there might be some funky transcendental computations. Or it might just be rounding rules that are underspecified, I don't know yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two comments: