strange behaviour with simple decimals (fp comparison)
Subject: strange behaviour with simple decimals (fp comparison)
From: Stavros Macrakis
Date: Fri, 13 Apr 2007 12:16:50 -0400
On 4/13/07, Kostas Oikonomou <ko at research.att.com> wrote:
>
> With respect to this debate, I think it is easy enough for
> each user to set fpprintprec to whatever is felt to be
> "right" in their .maxima/maxima-init.mac file. (E.g., I
> like small values, like 6, because I normally find too many
> decimals distracting.)
Agreed; but the question is what the default should be for those users who
are not sophisticated enough to set fpprintprec or to put together an init
file. It's interesting to see that you and others think that 6-8 digits is
more reasonable than 16. As a "marketing" matter, there might be the danger
of having naive beginning users think that Maxima is "less accurate" than
other systems if the default is too small, though.
Apart from that, how about focusing on the issue of
> (approximate) equality of floating point numbers?
... And an approximate equality, "~", say, might
>
help with the problem "is 3*1.4? = 5.88"?
>
Several issues here.
- The user didn't ask if 3*1.4^2=5.88. He observed the displayed
value of 3*1.4^2.
- He is as likely (perhaps more so) to try 3*1.4^2-5.88, and I see no
way of avoiding the result -9e-16 without actually performing exact
arithmetic.
- The = sign in Maxima today means "syntactic identity" -- is(2.0 = 2)
is false as is (assume(equal(a,b)), is(a=b)), so we can't use that sign for
approximate equality (whether "=" and equal do the right thing today is
another matter; let's not discuss it now)
- I suspect that users have to get pretty sophisticated before they
understand the uses of "equal", at which point they will probably want to
have access to both exact and approximate equals, so it doesn't seem like a
good idea to change equal itself.
- On the other hand, if a distinct sign (~) is used for approximate
equality, the naive new user will surely not know about it, either.
Why don't you try your hand at defining a useful approximate equality
package for floats and contribute it to share? We may decide to incorporate
it into the core system, or keep it as an option.
-s