A puzzling arithmetic error in Maxima



Thanks again, very much. This is an eye opening. 


Richard Fateman [15/11/03 17:49 -0800]:
> .......

> The problem you find in Maxima is probably present in
> every other computer system you have ever used.  Occasionally
> the output formatting program may fudge the answer to print
> 0.9999999 to 1.0  but this leads to errors where 1.0-1.0
> is not 0.
> 
> RJF
> 

I just tested the idea using Scilab, and the same example.
  Scilab's answer to 57.50+.... was "the correct one" 251.80,
	but when I did 251.80-ans, I got 1.137E-13!

Milan
	   
> 
> Milan Lukic wrote:
> 
> >Thank you. I am not sure what to think of this, other than that it
> >would be desirable not to have this kind of error. 
> >
> >BTW, when I did ratsimp(d185),float; -  Maxima produced 251.8!
> >
> >Richard Fateman [15/11/03 11:20 -0800]:
> > 
> >
> >>probably because 1/10, 1/100, etc is not exactly representable in binary.
> >>It is presumably a function of the decimal-to-binary conversion program
> >>in the (C? library), and is not specific to Maxima or even Lisp.
> >>
> >>
> >>Milan Lukic wrote:
> >>
> >>   
> >>
> >>>(C185) 
> >>>57.50+14.95+18.95+8.95+22.95+12.95+7.95+6.95+19.95+12.95+8.95+9.95+
> >>>16.95+19.95+11.95;
> >>>
> >>>(D185)                         251.7999999999999
> >>>
> >>>Anybody has an idea why Maxima produced 251.799.... instead of 251.8?
> >>>
> >>>Milan
> >>>
> >>>_______________________________________________
> >>>Maxima mailing list
> >>>Maxima@www.math.utexas.edu
> >>>http://www.math.utexas.edu/mailman/listinfo/maxima
> >>>
> >>>
> >>>     
> >>>
> >
> >_______________________________________________
> >Maxima mailing list
> >Maxima@www.math.utexas.edu
> >http://www.math.utexas.edu/mailman/listinfo/maxima
> > 
> >
>