]> 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)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Mar 2018 19:59:18 +0000 (12:59 -0700)
commit42e7e267e5487f60f4d72e1b5c5cba001ba4d704
tree8c44c5c43eb779d4478b45b66095e94000b78032
parentd0881374734310eb77526823c0acad1fe556f41b
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