MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Zero does not Equal Zero

  • To: mathgroup at
  • Subject: [mg31281] Re: Zero does not Equal Zero
  • From: Adam Smith<adam.smith at>
  • Date: Fri, 26 Oct 2001 04:28:27 -0400 (EDT)
  • References: <9qokvl$mu2$>
  • Sender: owner-wri-mathgroup at

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.

x=SetPrecision[1234567890123456789012, 21.35];
{x-y, x-y\[Equal]0}


x=SetPrecision[1234567890123456789012, 21];
{x-y, x-y\[Equal]0}


In article <9qokvl$mu2$1 at>, Ersek, Ted R says...
>Hello Group,
>I am using Mathematica Version 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.
>  x=SetPrecision[1234567890123456789012, 21.35];
>  y=x-6/5;
>  {x-y, x-y==0}
>  {0., False}
>For what it's worth, the next line shows that the precision of (x-y) is
>(0.0366) almost zero.
>  InputForm[x-y]
>  1.2`0.0366
>  Ted Ersek
>  Check Mathematica Tips, Tricks at

Adam Smith
Dept. of Physics
Hillsdale College
adam.smith at

  • Prev by Date: FW: Carriage Return oddity in Mathematica (follow-up)
  • Next by Date: Re: Export of Cells in Bitmap
  • Previous by thread: Zero does not Equal Zero
  • Next by thread: Re: Re: Zero does not Equal Zero