[Date Index]
[Thread Index]
[Author Index]
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[13]:=
FullForm[x-y]
Out[13]//FullForm=
1.2`0.0366
and
In[11]:=
0.\[Equal]0
Out[11]=
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[1]:=
> x=SetPrecision[1234567890123456789012, 21.35];
> y=x-6/5;
> {x-y, x-y\[Equal]0}
>
> Out[3]=
> {0.,False}
>
> In[4]:=
> x=SetPrecision[1234567890123456789012, 21];
> y=x-6/5;
> {x-y, x-y\[Equal]0}
>
> Out[6]=
> {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[1]:=
> > x=SetPrecision[1234567890123456789012, 21.35];
> > y=x-6/5;
> > {x-y, x-y==0}
> >
> >Out[3]=
> > {0., False}
> >
> >
> >----------
> >For what it's worth, the next line shows that the precision of (x-y) is
> >(0.0366) almost zero.
> >
> >In[4]=
> > InputForm[x-y]
> >
> >Out[4]=
> > 1.2`0.0366
> >
> >-----------
> >Regards,
> > Ted Ersek
> > Check Mathematica Tips, Tricks at
> > http://www.verbeia.com/mathematica/tips/Tricks.html
> >
> >
>
> Adam Smith
> Dept. of Physics
> Hillsdale College
> adam.smith at hillsdale.edu
>
>
Prev by Date:
**Re: Thickness of Lines and Arcs**
Next by Date:
**Re: Solution for coupled PDE via Mathematica**
Previous by thread:
**Re: Zero does not Equal Zero**
Next by thread:
**Zero does not equal Zero**
| |