# [Maxima] Big float Round off errors

Richard Fateman fateman at cs.berkeley.edu
Tue May 6 10:27:44 CDT 2008

```Trying to show that u can be computed, I ran into this bug..
Maxima 5.14.0 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL)
..
(%i2) rat(bfloat(0.1));
`pquotient' by zero
-- an error.  To debug this try debugmode(true);
(%i3)

.....
Independent of this bug, for other examples, the result is also
unsatisfactory
because the conversion which should be exact (in my opinion) is set up to
round, which sometimes
fool the eye.  That is, bfloat(1/10) converted to rational should not be
1/10 because
it is not. Proof:
x:bfloat(1/10);
fpprec:100;
bfloat(x) -->
1.0000000000000000034694469519536141888238489627838134765625b-1

I recall people fussing with conversion and probably making the wrong
choice,
which makes it impossible to trivially compute your "u", though it is
trivially possible in
an unbroken common lisp.

but apparently there is also an outright bug.

Common Lisp itself has two functions, rational and rationalize.

(- 1/3 (rationalize (/ 1.0 3.0)))--> 0  ; this is apparently used by Maxima
now, a mistake, I think.
(- 1/3 (rational (/ 1.0 3.0))) -1/100663296 ; this should be used by
Maxima, just so you can compute u.
This latter computation tells you that this single precision representation

note that ratepsilon is probably involved in Maxima's computation.

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Richard Hennessy
> Sent: Tuesday, May 06, 2008 12:40 AM
> To: Maxima List
> Subject: [Maxima] Big float Round off errors
>
> "Floating-point operations are not exact, but they can be modeled as:
> fl( x op y ) = (1+D) (x op y)
> where |D| <= u, u is the unit round off or machine precision"
>
> I found this on the Internet and it is about running error
> analysis for numerical algorithms.  I just want to know the
> value of u for big floats as a function of fpprec (as opposed
> to machine precision) since Maxima big floats are running in
> a virtual machine?  Does anyone know how round off is handled
> with big floats.
>
> Thanks,
>
> Rich
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
```