MathGroup Archive 2004

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47574] Re: [mg47525] Re: When Is Precision[ ] $MachinePrecision, And When Is It Not?
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 16 Apr 2004 05:20:59 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <c5dhrd$nqp$1@smc.vnet.net> <c5gg7l$att$1@smc.vnet.net> <200404150739.DAA11614@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

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?