]> git.eshelyaron.com Git - emacs.git/commit
Avoid Fortran-style floating-point optimization
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Mar 2018 19:57:39 +0000 (12:57 -0700)
committerAndrew G Cohen <cohen@andy.bu.edu>
Tue, 11 Dec 2018 06:17:58 +0000 (14:17 +0800)
commit17a41a948d4d9155b02eb33afee3c409f506e536
tree88a00461b428108c8aa20d8d02e222affec821f0
parentbdea39bd45f8d81eeeb3efacc93e79c2b213dc1b
Avoid Fortran-style floating-point optimization

When optimizing arithmetic operations, avoid optimizations that
are valid for mathematical numbers but invalid for floating-point.
For example, do not optimize (+ 1 v 0.5) to (+ v 1.5), as they may
not be the same due to rounding errors.  In general,
floating-point numbers cannot be constant-folded, since that would
make .elc files platform-dependent.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-associative-math):
Do not optimize floats.
(byte-optimize-nonassociative-math, byte-optimize-approx-equal)
(byte-optimize-delay-constants-math, byte-compile-butlast)
(byte-optimize-logmumble):
Remove; no longer used.
(byte-optimize-minus): Do not optimize (- 0 x) to (- x).
(byte-optimize-multiply): Do not optimize (* -1 x) to (- x).
(byte-optimize-divide): Do not optimize (/ x -1) to (- x).
(logand, logior, logxor): Optimize with byte-optimize-predicate
instead of with byte-optimize-logmumble.
* test/lisp/emacs-lisp/bytecomp-tests.el:
(byte-opt-testsuite-arith-data): Add a couple of test cases.
lisp/emacs-lisp/byte-opt.el
test/lisp/emacs-lisp/bytecomp-tests.el