Re: How to increase Working Precision?



Richard J. Fateman wrote:


r has the property that it prints as 0.
r has the property that r+1 also prints as 0.
r has the property that r+1 == r evaluates as True.
There are many more properties that anyone with a copy of the program
can explore. Like r is a solution to the equation sin(x)=cos(x).

It is too easy for a number like r to be produced by a naive user, or
even a sophisticated one who doesn't understand the arithmetic.

While I don't agree with (most of) your earlier critique in this
thread, this one I feel genuine. (I regard testing for equality on
floats in general a user error, but the behavior of Mathematica when the
user does so anyway is one of the points where I regard the design of
the system to be completely off mark. Then again, in the end, it boils
down to a clear specification, although I still find it makes putting
floating point numbers into generic code (which usually handles just
about anything except floats properly) and either being lucky and
getting an obviously false result or an error or being unlucky and
having the same thing appear only at your customer all too easy.
Equality should be just that, and different floats simply are not equal,
even if they only disagree in a guard digit.

--
if all this stuff was simple, we'd
probably be doing something else. -- Daniel Lichtblau, s.m.symbolic
.



Relevant Pages

  • Re: 0^0 oh no!
    ... Christopher Creutzig writes: ... floats in general a user error ... FriCAS Computer Algebra System ...
    (sci.math.symbolic)
  • Re: Floating point bug?
    ... "never test floats for equality". ... [end quote] ... you often do want to test floating point values within some ...
    (comp.lang.python)
  • Re: Extremely wierd problem I just cannot explain...works in debug, does not work in release.
    ... I agree with Adam: comparing floats / doubles for equality is a big ... a float or double should be used to store _only_ measured ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Float comparison
    ... How can I check for [floating-point] equality? ... You can only see if two floats are very close to each other. ... was an entirely accurate representation of the value the programmer ...
    (comp.lang.c)
  • Re: ocaml question
    ... E.g. if the representation is redundant when compared to the abstract values, your notion of equality will change depending on whether you're "above" or "below" the abstraction barrier. ... Throw in round-off errors, and comparing for equality begins to not even make sense for floats. ... There are equivalence classes, that's all. ... Well, OK, for integers, characters, and finite lists over them, standard equality does make sense. ...
    (comp.lang.functional)

Quantcast