MathGroup Archive 2004

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

Search the Archive

Re: Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?


Evidently the exact value 2/3 on the right of

   N[2/3]==2/3

is converted to floating point before the comparison is made.  (Same 
thing happens, for example, in 3.1 + 2/3)

But:

  N[2/3]===2/3
False

Look up == (or Equal) and === (SameQ) in the HelpBrowser.

Harold Noffke wrote:
> Bobby:
> 
> Thanks for your examples.  I thought about them, and found a very
> short one which still bothers me, because the answer is not what I
> expected ...
> 
> In[1]:= N[2/3]
> 
> Out[1]= 0.666667
> 
> In[2]:= N[2/3]==2/3
> 
> Out[2]= True
> 
> In[3]:= ?==
> lhs == rhs returns True if lhs and rhs are identical.
> 
> Regards,
> Harold
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Saving as HTML -- Page width problems
  • Next by Date: Re: Critical memory leak with J/Link
  • Previous by thread: Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?
  • Next by thread: Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?