MathGroup Archive 2006

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

Search the Archive

Re: MemberQ

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68561] Re: MemberQ
  • From: leigh pascoe <leigh at cephb.fr>
  • Date: Wed, 9 Aug 2006 23:56:58 -0400 (EDT)
  • References: <200608090818.EAA21057@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Adriano Pascoletti wrote:
> Bruce Colletti wrote ..
>   
>> Re Mathematica 5.2.0.0.
>>
>> Since 0.7 is in the set {0.0, 0.1, 0.2,..., 0.9, 1.0}, why does MemberQ[Range[0.,
>> 1., .1], .7] return False?
>>  
>> Thankx.
>>
>> Bruce
>>
>>     
>
> Because the 0.7 in Range[0.0, 1.0, 0.1] is
>
> In[11]:=
> Range[0.0,1.0,0.1][[8]]//FullForm
> Out[11]//FullForm=
> 0.7000000000000001`
>
> and
>
> In[9]:=
> FullForm[0.7]
> Out[9]//FullForm=
> 0.7`
>
> They differ on the 16th decimal place as can be seen  evaluating 
> 0.7 - Range[0.0, 1.0, 0.1]
>
>
>
> Adriano Pascoletti
>
>
>
>   
So the curious thing is that it returns True for Ssezi and for me!

In[8]:=Range[0.,1.,.1][[8]]//FullForm
MemberQ[Range[0.,1.,.1],.7]

Out[8]//FullForm=0.7000000000000001`

Out[9]=True

LP


  • References:
    • Re: MemberQ
      • From: "Adriano Pascoletti" <pascolet@dimi.uniud.it>
  • Prev by Date: inflated nb-files
  • Next by Date: ODE, solving the fitzhugh-nagumo equations
  • Previous by thread: Re: MemberQ
  • Next by thread: Re: MemberQ