Zero does not equal Zero
- To: mathgroup at smc.vnet.net
- Subject: [mg31360] Zero does not equal Zero
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Tue, 30 Oct 2001 04:35:44 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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