wanted: constant folding for symbol constants
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This issue is inspired by @stassats's and @csr21-cantab's comments on lp#1335732.
We didn't do constant folding on defined constants for +/*, as evidenced by the following forms:
(defun foo (x)
(* x 2.1 3.1))
(defconstant +two-point-one+ 2.1)
(defconstant +three-point-one+ 3.1)
(defun bar (x)
(* x +two-point-one+ +three-point-one+))
(= (foo 1.1) (bar 1.1)) => NIL
As we do not allow redefining constants in SBCL, I believe it should be OK to do constant folding for defined constants (at least on integer types).
On the other hand, the above forms also suggest it might be a little inaccurate to do this kind of constant folding on floating point numbers. I really can't decide if this is a serious issue or not, though.
description: | updated |
Changed in sbcl: | |
status: | New → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Shouldn't it be the other way around? (* x 2.1 3.1) shouldn't be folded into (* x (* 2.1 3.1))?