MathGroup Archive 2005

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

Search the Archive

Re: The question of equality,...


On 9/17/05 at 2:32 AM, terryisnow at yahoo.com wrote:

>Ok I thought I understood this stuff but maybe not,...

>If I wanted to check for bit-for-bit equality of two arbitrary
>precision numbers (without regard to how many of those digits are
>meaningful) like the way it would be done using the "==" operator
>in C, then neither "==" nor "===" will do the job, is that correct?

Yes

>So what can I use then?

In[1]:=
x = 1. + 10^(-$MachinePrecision);
 
In[2]:=
x == 1.
Out[2]=
True

In[3]:=
x === 1.
Out[3]=
True

In[4]:=
RealDigits[x, 2] == RealDigits[1., 2]
Out[4]=
False
--
To reply via email subtract one hundred and four


  • Prev by Date: Visualization Site - Updates
  • Next by Date: another Bug in Reduce ?
  • Previous by thread: The question of equality,...
  • Next by thread: Re: The question of equality,...