Jan Rychter wrote:
> In the following snippet of code:
> 
>                   #'(lambda (v1 v2)
>                       (values (- (the double-float (log v1)) 
>                                  (the double-float (log v2)))
>                               0))
> 
> Is there a better way to tell CMUCL that I'm really sure that v1 and v2
> are greater than 0.0d0 and are double-floats, so that the compiler
> doesn't have to worry about the result of the logs becoming a COMPLEX?
> 
> I've tried things like:
> 
>   (declare (type (double-float 0.0d0) v1))
> 

That declaration means the v1 can be +/- 0.0 to +infinity, and CMUCL 
thinks log of -0.0 is a complex number.  You probably want

(declare (type (double-float (0d0)) v1)

This means v1 is strictly positive.  If v1 can also be +0.0, you can say

(declare (type (or (double-float (0d0) (member 0d0)) v1)

Ray


Reply via email to