strange behaviour with simple decimals



On 4/11/07, Jay Belanger <belanger at truman.edu> wrote:
>
> > This has nothing to do with Maxima,
>
> Since it is Maxima giving the result, I'd say it has everything to do
> with Maxima.  Here, it has to do with the way that Maxima handles
> floats.


Fair enough.

It may be worth noting that both Axiom and my pocket calculator give
> the correct answer to 3*1.4^2.
>

To how many digits? What are the results for (3*1.4^2)-5.88 or (5/9)*9-5? or
sin(3.1415926535897932385/4)-sqrt(1/2)?

I don't know how Axiom operates.  This may just be a rounding-on-display
issue, or it may actually calculate the answer differently internally
(decimal floats? rationals?)

Your pocket calculator may operate in decimal floating-point, in which case
it will get exact answers for 3*1.4^2 and the like, but not for other
calculations.

Do you have any suggestions on how to improve things?  The easist thing to
do so that the naive user sees fewer things like this is to set
fpprintprec:14 (or even less) by default.  In some sense, that is a cheap
trick, but then maybe that is appropriate.

              -s