MathGroup Archive 2007

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

Search the Archive

Re: Question about Union

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79231] Re: Question about Union
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Sat, 21 Jul 2007 04:35:33 -0400 (EDT)

On 7/20/07 at 3:36 AM, yaroslavvb at gmail.com (Yaroslav Bulatov) wrote:

>Union treats 2 numbers as distinct even though SameQ returns true
>for them...how does it test whether values are distinct by default?

>Union[{0.6342350954011774, 0.6342350954011775}]
>0.6342350954011774===0.6342350954011775

The problem here isn't with Union but with SameQ. Per the
documentation, SameQ returns True when the things being compared
are identical. From,

In[6]:= data = {0.6342350954011774, 0.6342350954011775};

In[7]:= SameQ @@ data

Out[7]= True

In[8]:= SameQ @@ (RealDigits /@ data)

Out[8]= False

it is clear SameQ returns true even when two machine precision
numbers are not identical.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Mathematica to .NET compiler
  • Next by Date: general
  • Previous by thread: Re: Question about Union
  • Next by thread: Re: strange bug?