       Re: Re: Zero does not Equal Zero

• To: mathgroup at smc.vnet.net
• Subject: [mg31302] Re: [mg31281] Re: Zero does not Equal Zero
• From: Otto Linsuain <linsuain at andrew.cmu.edu>
• Date: Sat, 27 Oct 2001 01:08:11 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Perhaps this is relevant:

With your definition of x and y

In:=
FullForm[x-y]

Out//FullForm=
1.2`0.0366

and

In:=
0.\[Equal]0

Out=
True

Otto Linsuain.

On Fri, 26 Oct 2001, Adam Smith wrote:

> The problem is that you specified a non-integer value for the number of digits
> of precision "21.35".  As shown below, if you set it equal to an integer things
> work out as expected.  I don't know what SetPrecision does intenally when it is
> a non-integer, but I agree that something strange happens.
>
> In:=
> x=SetPrecision[1234567890123456789012, 21.35];
> y=x-6/5;
> {x-y, x-y\[Equal]0}
>
> Out=
> {0.,False}
>
> In:=
> x=SetPrecision[1234567890123456789012, 21];
> y=x-6/5;
> {x-y, x-y\[Equal]0}
>
> Out=
> {0.,True}
>
>
>
>
> In article <9qokvl\$mu2\$1 at smc.vnet.net>, Ersek, Ted R says...
> >
> >Hello Group,
> >
> >I am using Mathematica Version 4.1.0.0 under Windows 98, but I suspect it
> >makes no difference what platform is used.
> >
> >The following demonstrates an inconsistency with arbitrary precision
> >arithmetic. The problem is that the criteria for deciding what numbers are
> >displayed as zero is different from the criteria for deciding if a number
> >equals zero.
> >
> >
> >In:=
> >  x=SetPrecision[1234567890123456789012, 21.35];
> >  y=x-6/5;
> >  {x-y, x-y==0}
> >
> >Out=
> >  {0., False}
> >
> >
> >----------
> >For what it's worth, the next line shows that the precision of (x-y) is
> >(0.0366) almost zero.
> >
> >In=
> >  InputForm[x-y]
> >
> >Out=
> >  1.2`0.0366
> >
> >-----------
> >Regards,
> >  Ted Ersek
> >  Check Mathematica Tips, Tricks at
> >  http://www.verbeia.com/mathematica/tips/Tricks.html
> >
> >
>