#1713 %pi^1.0b0 --> floating point value


The exponent is a bigfloat number, but a floating point number is returned:

(%i16) %pi^1.0b0;
(%o16) 3.141592653589793

(%i17) %gamma^1.0b0;
(%o17) .5772156649015329

The only case which is handled correctly is %e:

(%i18) %e^1.0b0;
(%o18) 2.718281828459045b0

That is the piece of code in simpexpt, which can handle the other numeric constants too:

((onep1 pot)
;; Exponent is One.
(let ((y (mget gr '$numer)))
(if (and y (floatp y) (or $numer (not (equal pot 1))))
;; Base is a numeric constant with a floating point value or
;; $numer is TRUE and the Exponent is not the integer One.
(return (if (and (member gr *builtin-numeric-constants*)
(equal pot bigfloatone))
;; Convert numeric constant to bigfloat value.
($bfloat gr)
;; Can we reach this point?
;; Handle other cases in exptrl.
(return (exptrl gr pot)))))
We get:

(%i16) %pi^1.0b0;
(%o16) 3.141592653589793b0
(%i17) %gamma^1.0b0;
(%o17) 5.772156649015329b-1
(%i18) %phi^1.0b0;
(%o18) 1.618033988749895b0

Dieter Kaiser


  • 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 return a bigfloat number, if the exponent is bigfloat one. 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