# [Maxima] all computations to be done in extended precision?

Richard Fateman fateman at cs.berkeley.edu
Tue Dec 18 14:00:57 CST 2007

```how about

f(x,y):=block([fpprec:50], 0.0b0+x^2+y^2);

But this may not be what you want, since it computes 2.1^2 IN SINGLE
PRECISION, and then adds it up to 50 digits etc.

Probably you want
fpprec:50\$

f(x,y):=x^2+y^2;

f(2.1b0, 3.2b0);  which gives 1.465b1, not some bunch of garbage.

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of S. Newhouse
> Sent: Tuesday, December 18, 2007 11:53 AM
> To: maxima at math.utexas.edu
> Subject: [Maxima] all computations to be done in extended precision?
>
> Hello,
>  Is there a declaration at the beginning of a program to have all
> calculations done in extended precision?
>
> It's a little cumbersome to do, e.g.
> %i39) fpprec: 50;
> Evaluation took 0.00 seconds (0.00 elapsed) using 0 bytes.
> (%o39)                                50
> (%i40) f(x,y):= bfloat(x)^2 + bfloat(y)^2;
> Evaluation took 0.00 seconds (0.00 elapsed) using 0 bytes.
>                                        2            2
> (%o40)                f(x, y) := bfloat (x) + bfloat (y)
> (%i41) f(2.1,3.2);
> Evaluation took 0.00 seconds (0.00 elapsed) using 0 bytes.
> (%o41)       1.4650000000000001509903313490212934419184329654106b1
>
> TIA,
>  -sen
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
```