[Openmcl-devel] ccl::log-e and bignum arg

Raymond Wiker rwiker at gmail.com
Wed Jun 2 03:48:56 UTC 2010

As far as I can work out, it goes like this:

A negative real number x is equivalent to the complex number (x, pi), which is x*expt(pi*i).

The logarithm of a product is the sum of the logarithm of the factors, so

log-e(x) = log-e(* x (expt(pi*i))
= (+ log-e(x) log-e(* pi i))
= (+ log-e(x) (* pi i))
= complex(log-e(x) pi)

On Jun 1, 2010, at 22:17 , R. Matthew Emerson wrote:

> I don't understand what CCL::LOG-E is doing when it gets a bignum.
>
> Can anyone clue me in?  Any links, references, etc. appreciated.
>
> If anyone
> (defun log-e (x)
>  (cond
>    ((bignump x)
>     (if (minusp x)
>       (complex (log-e (- x)) pi)
>       (let* ((base1 3)
>              (guess (floor (1- (integer-length x))
>                            (log base1 2)))
>              (guess1 (* guess (log-e base1))))
>         (+ guess1 (log-e (/ x (expt base1 guess)))))))
>    ...))
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel