Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'float': 0.07; 'string': 0.09; 'defines': 0.09; 'subject:set': 0.09; 'subset': 0.09; 'valueerror:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '*any*': 0.16; 'finite': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'notation': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'implementing': 0.19; 'feb': 0.22; '>>>': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; '"",': 0.31; 'restricted': 0.31; 'subject:numbers': 0.31; 'subject:size': 0.31; 'way?': 0.31; 'writes:': 0.31; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'subject:the': 0.34; 'could': 0.34; 'subject: (': 0.35; 'subject:with': 0.35; "can't": 0.35; 'convert': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'url:org': 0.36; 'being': 0.38; 'represent': 0.38; 'ben': 0.38; 'url:library': 0.38; 'skip:[ 10': 0.38; 'pm,': 0.38; 'rather': 0.38; 'recent': 0.39; '12,': 0.39; 'system.': 0.39; 'numbers': 0.61; 'simply': 0.61; 'real': 0.63; 'abc': 0.84; 'etc,': 0.84; "it'd": 0.84; 'start.': 0.84; 'numbers:': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=b3oWHsSEqOhrq6S/gN4gRttbabizgTznPCFgHZbH7rU=; b=tmU+fMsjLXRJLMIuHVbpIqoRPHGf4W2jVrtrwly7afH9PiF2Adb7VvUWledK71+K4x y4OidioYgeeUDtzx/M3rv8CSW/i4PyzU+zBEUL8kJhnTvkFjJ826azDvh72ov7RNxEax ldrNQBUt1oRA6XWmIkok14tF7JdbZG2giQd8s0bhOagLAz0yMPgqqs18gMYmHGybv20J 8kMhJE0HzeaWoJb9VelthRSTFT17oAFmkZXC4P33m/YOOrQcgzpTIe5JV+i7D4F2YEDH frbsmczKkFTELNlg5qGlnx9UnGQkMM5HWc0MovQtiauGKyuFW97FMPTgZpP9d5ZY0POF I3lA== MIME-Version: 1.0 X-Received: by 10.66.164.229 with SMTP id yt5mr38374857pab.67.1392194876038; Wed, 12 Feb 2014 00:47:56 -0800 (PST) In-Reply-To: <85r478bv99.fsf_-_@benfinney.id.au> References: <8e4c1ab1-e65d-483f-ad9d-6933ae2052c3@googlegroups.com> <7e7d3200-a4ae-4842-ad8d-68b4435b9006@googlegroups.com> <52f219c5$0$29972$c3e8da3$5496439d@news.astraweb.com> <888bd2fc-54b0-4c46-9d7b-d81d01a78b52@googlegroups.com> <52f59aeb$0$29972$c3e8da3$5496439d@news.astraweb.com> <7cc8f49d-a4c7-48c2-a0af-ac58c847d794@googlegroups.com> <71e578f8-0d23-4b8e-b9f2-b987bdc9c01d@googlegroups.com> <85r478bv99.fsf_-_@benfinney.id.au> Date: Wed, 12 Feb 2014 19:47:55 +1100 Subject: Re: Working with the set of real numbers (was: Finding size of Variable) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392194885 news.xs4all.nl 2919 [2001:888:2000:d::a6]:51691 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66011 On Wed, Feb 12, 2014 at 7:17 PM, Ben Finney wr= ote: > Chris Angelico writes: > >> I have yet to find any computer that works with the set of real >> numbers in any way. Never mind optimization, they simply cannot work >> with real numbers. > > Not *any* computer? Not in *any* way? The Python built-in =E2=80=98float= =E2=80=99 type > =E2=80=9Cworks with the set of real numbers=E2=80=9D, in a way. No, the Python built-in float type works with a subset of real numbers: >>> float("pi") Traceback (most recent call last): File "", line 1, in float("pi") ValueError: could not convert string to float: 'pi' >>> float("=CF=80") Traceback (most recent call last): File "", line 1, in float("=CF=80") ValueError: could not convert string to float: '=CF=80' Same goes for fractions.Fraction and [c]decimal.Decimal. All of them are restricted to some subset of rational numbers, not all reals. > The ABC > defines behaviours for types implementing the set of real numbers. > > What specific behaviour would, for you, qualify as =E2=80=9Cworks with th= e set > of real numbers in any way=E2=80=9D? Being able to represent surds, pi, e, etc, for a start. It'd theoretically be possible with an algebraic notation (eg by carrying through some representation like "2*pi" rather than 6.28....), but otherwise, irrationals can't be represented with finite storage and a digit-based system. ChrisA