Re: Zero does not equal Zero
- To: mathgroup at smc.vnet.net
- Subject: [mg31368] Re: [mg31360] Zero does not equal Zero
- From: Otto Linsuain <linsuain at andrew.cmu.edu>
- Date: Wed, 31 Oct 2001 03:30:59 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I could not reproduce your error, here is my output from Mathematica 4
In[1]:=
y=x+SetPrecision[5.9*^-450,30];
{y-x,y-x\[Equal]0}
Out[2]=
\!\({5.89999999999999999999999999999902278223326`30*^-450, False}\)
I pasted this from a Mathematica notebook. A very curious point is that,
in the notebook, the output looked like:
{5.90000000000000000000000000000000000000 x 10^-450, False}
but it changed upon "mousing" it !!
But still, I haven't been able to reproduce a situation where x-y prints
0. x 10^some power and x-y==0 prints False. Also, we have to reckon with
the fact that the output of x-y depends on printing options, besides
precision.
Well, that is my grain of sand. Otto Linsuain.
On Tue, 30 Oct 2001, Ersek, Ted R wrote:
> Hello Group,
>
> It seems people didn't fully grasp the inconsistency that I pointed to in my
> earlier message with the same subject. I came across this problem when I
> tried to make my RootSearch package (recent MathSource addition) capable of
> finding roots to a an arbitrary precision. To allow that I had to make a
> function similar to Ulp[x] in the NumericalMath`Microscope` package. Among
> other things my version of Ulp can work with arbitrary precision numbers.
> Unfortunately I can't make RootSearch work as well as I would like because
> of the problem I demonstrate below.
>
> First consider the next line which demonstrates that a StandardForm output
> such as (0. x 10^-20) represents an arbitrary precision number that is more
> or less zero.
>
> In[1]:=
> x=Exp[ N[Pi/3, 20] ];
> x-x
>
> Out[1]=
> 0. x 10^-20
>
>
> Now suppose we want to find the arbitrary precision number that is slightly
> larger than x, but as close as possible to x and still a different number.
> What do I mean when I say "a different number"? Well if x and y are
> different numbers their difference should not be zero. In the first case
> below I view x and y as essentially the same number.
>
> In[2]:=
> y=x+SetPrecision[5.96*^-20, 30];
> {y-x, y-x==0}
>
> Out[4]=
> {0. x 10^-20, True}
>
>
> What about the next case. Here the StandardForm of (x-y) looks like zero,
> but (x-y==0) returns False. Are x and y "different numbers"? Why does
> (x-y) return False in the next line, but True in the slightly different case
> above? I think when comparing numeric values (x-y==0) should return True
> IF AND ONLY IF the StandardForm of (x-y) is zero. When I say "is zero",
> that includes (0. x 10^-20) and similar output.
>
>
> In[5]:=
> y=x+SetPrecision[5.97*^-20, 30];
> {y-x, y-x==0}
>
> Out[6]
> {0. x 10^-20, False}
>
>
> --------
> Regards,
> Ted Ersek
>
>
>