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

cmucl cmucl-devel at common-lisp.net
Fri Jan 25 04:42:35 UTC 2013


#65: Different results for EXPT between compiled and interpreted code
---------------------+------------------------------------------------------
  Reporter:  rtoy    |       Owner:  somebody
      Type:  defect  |      Status:  reopened
  Priority:  major   |   Milestone:          
 Component:  Core    |     Version:  2012-12 
Resolution:          |    Keywords:          
---------------------+------------------------------------------------------
Changes (by rtoy):

  * status:  closed => reopened
  * resolution:  fixed =>


Comment:

 Some cases were missed in the previous patch.  Here is a test that should
 cover all the cases.
 {{{
 (defun test-expt-xfrm ()
   (let (failures)
     (dolist (base '(2 2f0 2d0 2w0 #c(0 1) #c(0f0 1) #c(0d0 1) #c(0w0 1)))
       (dolist (power '(2 3 1/2 -2 -3 -1/2 5))
         (dolist (power-type '(rational single-float double-float double-
 double-float
                               (complex single-float) (complex double-
 float)
                               (complex double-double-float)))
           (let* ((pp (coerce power power-type))
                  (interp (expt base pp))
                  (compiled (funcall (compile nil `(lambda (b)
                                                     (declare (type ,(type-
 of base) b))
                                                     (expt b ,pp)))
                                     base)))
             (unless (= interp compiled)
               (push (list base pp interp compiled) failures)
               (format t "~S^~S =~%  ~S~%  ~S~%" base pp interp
 compiled))))))
     failures))
 }}}

 This should return {{{NIL}}} if everything is working correctly.

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


More information about the cmucl-ticket mailing list