2014-07-03 03:34:53 |
Jingyi Hou |
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. |
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. |
|