[cmucl-ticket] [cmucl] #65: Different results for {{{expt}}} between compiled and interpreted code

cmucl cmucl-devel at common-lisp.net
Thu Dec 13 02:44:40 UTC 2012


#65: Different results for {{{expt}}} between compiled and interpreted code
--------------------+-------------------------------------------------------
 Reporter:  rtoy    |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  major   |   Milestone:          
Component:  Core    |     Version:  2012-12 
 Keywords:          |  
--------------------+-------------------------------------------------------
 Consider
 {{{
 (defun sqr (x)
   (declare (type (complex double-float) x))
   (expt x 2))
 }}}

 Compare the results:
 {{{
 * (sqr #c(0d0 1d0))
 #C(-1d0 0d0)

 * (expt #c(0d0 1d0))
 #C(-1.0d0 1.2246467991473532d-16)
 }}}

 The difference is caused by a deftransform for {{{expt}}} that converts
 {{{(expt x 2)}}} to {{{(* x x)}}}.

 Perhaps the {{{expt}}} should be modified to do the same transformation
 when the power is one of the special values in the deftransform?  (The
 deftransform handles 2, 3, 4, and 1/2.)

-- 
Ticket URL: <http://trac.common-lisp.net/cmucl/ticket/65>
cmucl <http://common-lisp.net/project/cmucl>
Cmucl is a high-performance, free Common Lisp implementation.


More information about the cmucl-ticket mailing list