On 3/28/09, Edwin Woollett <woollett at charter.net> wrote:
> On 3-28-09 Edwin Woollett wrote:
> -------------------------------------
> Using fpprintprec inside a block with
> a bigfloat produces
> results I don't understand.
> ------------------------------------------------------------
> (%i1) fpprintprec : 8$
>
> (%i2) bf1 : bfloat ( integrate ( exp(x), x, -1, 1 ) ), fpprec:45;
> (%o2) 2.3504023b0
>
> (%i3) bfprint (bf, fpp) :=
> block( [fpprintprec ],
> fpprintprec : fpp,
> print ( " ", x, " ", bf ) )$
>
> (%i4) for x : 10 thru 18 do bfprint ( bf1, x)$
> 10 2.350402387b0
> 11 2.3504023872b0
> 12 2.35040238728b0
> 13 2.350402387287b0
> 14 2.3504023872876b0
> 15 2.3504023872876b0
> 16 2.35040238728760291376476370119120163031143596b0
> 17 2.35040238728760291376476370119120163031143596b0
> 18 2.35040238728760291376476370119120163031143596b0
> (%i5) ( fpprintprec : 50, print ( bf1 ) )$
> 2.35040238728760291376476370119120163031143596b0
>
> --------------------------------------------
> The number printed for fpp >= 16 is the 45 digit number
> originally generated with bfloat.
> ===============================
> I should have paid more attention to the manual.
Well, the manual seems to describe the actual behavior,
which is good, I guess, although that behavior is slightly nutty.
Probably instead of comparing fpprintprec to the current
value of fpprec, the comparison should be fpprintprec to
the value of fpprec that was in effect when the bigfloat in
question was constructed. Yes, no, maybe?
best
Robert Dodier