Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: MemberQ

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68524] Re: [mg68503] MemberQ
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 9 Aug 2006 04:18:24 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200608081028.GAA29635@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

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


  • References:
    • MemberQ
      • From: Bruce Colletti <vze269bv@verizon.net>
  • 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