Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: The question of equality,...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60494] Re: The question of equality,...
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sun, 18 Sep 2005 01:15:50 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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,...