Float() and numer



On 5/24/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> On 5/23/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> > This is because FLOAT has an explicit special case for ^ and ^^, where
> it
> > does not evaluate the exponent as a float.  This is to avoid things like
> > float(x^2-x+1) => x^ 2.0-x+1.
>
> Doesn't the special case for ^ have something to do with the exp(x)
> --> %e^x simplification?
> The goal being, iirc, to avoid stuff like exp(x), numer => 2.72^x.
>

Yes, that's true in numer, but not in float:

      float(%e^x) => 2.718^x
      ev(%e^x,numer) => %e^x
      ev(%e^x,%enumer,numer) => 2.718

Not entirely clear whether all the differences between numer and float are
well thought-out (see below), but the proposed change has to do only with
the <float>^<something> case in FLOAT, not in NUMER.  This makes FLOAT much
more useful when you really want to crunch down to a number if at all
possible (e.g. for plotting, numerical integration, etc.) without using EV
(cf. my recent mails and bug report 1724592
<https://sourceforge.net/tracker/index.php?func=detail&aid=1724592&group_id=4933&atid=104933>for
reasons to avoid EV in this
case).<https://sourceforge.net/tracker/index.php?func=detail&aid=1724592&group_id=4933&atid=104933>;

              -s


Examples of current behavior, none of which will change with the proposal:

       ev(x^2-1,numer) => x^2-1
       ev(x^2-%pi,numer) => x^2-3.14
       float(x^2-1) => x^2-1.0
       float(x^2-%pi) => x^2-3.14