Float() and numer



On 5/23/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> I propose that the NUMER flag apply not only to MEVAL, but also to FLOAT


Another, slightly more radical, possibility, is to float the exponent in
base^exponent whenever float(base) is itself a float.  I don't see any
downside to this -- I was probably being too cautious before.    But numer
is still useful to make everything you can into a float when the whole
expression is not a float.

See code below.  Doesn't break testsuite.  Any objections?

           -s

(defmfun $float (e)
  (cond ((numberp e) (float e))
    ((and (symbolp e) (mget e '$numer)))
    ((or (atom e) (member 'array (cdar e) :test #'eq)) e)
    ((eq (caar e) 'rat) (fpcofrat e))
    ((eq (caar e) 'bigfloat) (fp2flo e))
    ((and (null $numer)             ; only treat expt specially if
$numer=nil
          (memq (caar e) '(mexpt mncexpt)))
     (let ((floatbase ($float (cadr e))))
       (simplify (list (ncons (caar e))   ; simplify is new; this was a bug
               floatbase
               (if (mnump floatbase) ; if base is float, float the expt
                   ($float (caddr e))
                 (caddr e))))))
    (t (recur-apply #'$float e))))