You can do exact rational arithmetic in macsyma.
5750/100+1495/100 +.... which is what ratsimp does. It converts
floats to rationals and then does the arithmetic.
When you use decimal points you are inputting only numbers
that can be represented in binary float values, and they are
not the same rational numbers that you think you have in decimal
notation. When ratsimp converts numbers that are very nearly
the same as a rational number, it shifts it very slightly.
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
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
>
>