Richard,
thank you for your answer. I played around with it and tried to find a way to change the
precision just locally in a block and to preserve the original fpprec in top level.
The workaround I found for defining a function with different local fpprec was a three step
definition:
(%i1) save_global: fpprec$
(%i2) foo():= block( [fpprec:20], ''(fpprec:20),
print(1.12345678901234567890b0, bfloat(%pi)) )$
(%i3) fpprec: save_global$
Now foo works as intended.
(%i4) foo()$
1.1234567890123456789b0 3.1415926535897932385b0
Is there a more elegant way?
Volker van Nek
Am 12 Jan 2008 um 10:36 hat Richard Fateman geschrieben:
>
> try
> ( ''(fpprec:100), [fpprec, 1.123456890123456890123456890b0] );
> That is two ' [apostrophe or single-quote).
>
>
>
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu]
> On Behalf Of van Nek
> Sent: Saturday, January 12, 2008 9:23 AM
> To: Maxima at math.utexas.edu
> Subject: Maxima parser and global parameters
>
>
>
> (%i1) ( fpprec:100, [fpprec, 1.123456890123456890123456890b0]
> );
> (%o1) [100, 1.123456890123457b0]
> (%i2) ( ibase:2, [ibase, 11111111] );
> (%o2) [2, 11111111]
>
>
> This shows me that in a first step the complete expression is
> read and parsed and in a
> second step the expressions are evaluated from left to right.
>
> Is it generally possible, that expressions like fpprec:100 can
> have an influence on the
> parser inside of the same expression, or can it only have effect
> on the next read in
> expression?
>
> Volker van Nek