MathGroup Archive 2006

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

Search the Archive

Re: MemberQ


Roundoff error?  Remember that decimals are converted to, and 
manipulated arithmetically as binary, then converted back. Look at this:

    $Version
5.2 for Microsoft Windows (June 20, 2005)
    $MachinePrecision
15.9546
    NumberForm[Range[0., 1., .1], 16]
{0.,0.1,0.2,0.3,0.4,0.5,0.6000000000000001,0.7000000000000001,0.8,0.9,1.}
    NumberForm[.7, 16]
0.7


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?

-- 
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: need mathematica's help for exploring a certain type of mapping
  • Next by Date: Re: MemberQ
  • Previous by thread: Re: MemberQ
  • Next by thread: Re: MemberQ