#21 float needs to be eval. with numer

closed
nobody
5
2007-09-01
2002-03-18
No

See below... we'd like to see "float(exp(exp(2)))" evaluated
to 1618.177991912654.

(C1) float(exp(exp(2)));

2
%E
(D1) 2.718281828459045
(C2) float(exp(exp(2))),numer;

(D2) 1618.177991912654
(C3)

Discussion

  • Stavros Macrakis

    Logged In: YES
    user_id=588346

    More cases: float(%pi^%pi)=> 3.14^%pi; float(2^%pi)
    =>2.0^%pi; but float((%e+%pi)^2) => 34.3.

    The intent is to avoid floating powers of symbolic objects.
    For example, you don't want float(x^2)=>x^2.0 or float(x^
    (1/3)) => x^0.333. But obviously this has been taken too
    far. If we can get a numerical result for the whole
    expression, we should (2^%e, %e^2, even %e^%pi).

    Numer and float just aren't very well thought-out.

     
  • Robert Dodier

    Robert Dodier - 2006-03-26

    Logged In: YES
    user_id=501686

    For the record, same behavior for all examples in Maxima 5.9.3.

    (%i10) float(exp(exp(2)));
    (%o10) 2.718281828459045^%e^2
    (%i11) float(exp(exp(2))), numer;
    (%o11) 1618.177991912654
    (%i12) float(%pi^%pi);
    (%o12) 3.141592653589793^%pi
    (%i13) float(2^%pi);
    (%o13) 2.0^%pi
    (%i14) float((%e+%pi)^2);
    (%o14) 34.33812894536713

     
  • Robert Dodier

    Robert Dodier - 2006-03-26
    • labels: --> 460522
     
  • Robert Dodier

    Robert Dodier - 2006-03-26

    Logged In: YES
    user_id=501686

    See also [ 586688 ] numer and float problem. (more of the
    same, with different examples).

     
  • Robert Dodier

    Robert Dodier - 2006-03-26

    Logged In: YES
    user_id=501686

    More of the same: [ 609464 ] 1+%e,numer and %e^%e,numer

     
  • Robert Dodier

    Robert Dodier - 2006-08-27
    • labels: 460522 --> Lisp Core - Floating point
     
  • Dan Gildea

    Dan Gildea - 2007-09-01

    Logged In: YES
    user_id=1797506
    Originator: NO

    Fixed in comm.lisp 1.24
    $float does not floatify exponent unless whole expression evaluates to a float.
    float(x^(1/3)) -> x^(1/3)
    float(exp(exp(2))) -> 1618.17799

    Does not fix 586688 and 609464.

     
  • Dan Gildea

    Dan Gildea - 2007-09-01
    • status: open --> closed
     

Log in to post a comment.