#1714 %pi^2.0b0 does not evaluate numerically

closed
nobody
5
2009-07-25
2009-07-21
No

Maxima evaluates numeric constants numerically, if the exponent is a floating point number or $numer is T:

(%i3) %pi^2.0;
(%o3) 9.869604401089358
(%i4) %gamma^2.0;
(%o4) .3331779238077187
(%i5) %pi^2,numer;
(%o5) 9.869604401089358
(%i6) %gamma^2,numer;
(%o6) .3331779238077187

But it does not work if the exponent is a bigfloat number (only %e works):

(%i9) %pi^2.0b0;
(%o9) %pi^2.0b0
(%i10) %gamma^2.0b0;
(%o10) %gamma^2.0b0

This is a piece of code in simpexpt, which will change this:

(t
(let ((y (mget gr '$numer)))
;; Check for a numeric constant.
(and y
(floatp y)
(or (floatp pot)
;; The exponent is a bigfloat. Convert base to bigfloat.
(and ($bfloatp pot)
(member gr *builtin-numeric-constants*)
(setq y ($bfloat gr)))
(and $numer (integerp pot)))
;; The evaluation is done in exprtl.
(return (exptrl y pot))))))

(%i12) %pi^2.0b0;
(%o12) 9.869604401089359b0
(%i13) %gamma^2.0b0;
(%o13) 3.331779238077187b-1

Dieter Kaiser

Discussion

  • Dieter Kaiser

    Dieter Kaiser - 2009-07-25
    • status: open --> closed
     
  • Dieter Kaiser

    Dieter Kaiser - 2009-07-25

    With revision 1.87 of simp.lisp all numeric constants are evaluated numerically, if the exponent is a bigfloat number. Closing this bug report as fixed.

    Dieter Kaiser

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks