On Tue, 14 Dec 2004, Harvey J. Stein wrote:

> The compiler won't unbox the result of (one-normal-rand) and
> (callpay), and I still don't know why. 

Hm, first of all, I suppose you should get lots of

 Unable to optimize due to type uncertainty

compiler notes. If so, you should provide the compiler with the 
proper additional type information. Macros will help. Besides this, you 
may think of making one-normal-rand


(defun one-normal-rand ()
  (declare (values (double-float)))
  (labels ((onr ()
             (let* ((u (random 1d0))
                    (u1 (random 1d0)))
               (declare (type (double-float (0d0) 1d0) u u1))
               (let* ((v (* SQRT2OVERE (- (* 2d0  u1) 1d0)))
                      (x (/ v u))
                      (y (/ (* x x) 4d0)))
                 (if (and (> y (- 1d0 u))
                          (> y (- (log u))))
                     (onr)
                     x)))))
    (onr)))

so that you can let the compiler inline it. And besides that, there 
furthermore would be block compilation.

-- 
regards,               [EMAIL PROTECTED]              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

Reply via email to