Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Mon, 23 May 2016 13:24:30 -0600 Lines: 21 Message-ID: References: <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <57422e03$0$1596$c3e8da3$5496439d@news.astraweb.com> <85r3ct9zt2.fsf@benfinney.id.au> <5742bacb$0$1526$c3e8da3$5496439d@news.astraweb.com> <87zirgrgol.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de PoOeOJ5b+tI0eglW2RvceQvjPVlFThsWciWYfmrpdN9w== 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; 'binary': 0.05; 'imply': 0.07; 'integers': 0.09; 'subject:while': 0.09; 'received:209.85.218': 0.10; 'thread': 0.10; '2016': 0.16; '23,': 0.16; 'correctness': 0.16; 'operation,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'integer': 0.18; 'otherwise,': 0.20; "aren't": 0.22; 'fraction': 0.22; 'defined': 0.23; 'header:In- Reply-To:1': 0.24; 'mon,': 0.24; 'error': 0.27; 'message- id:@mail.gmail.com': 0.27; 'correct': 0.28; 'values': 0.28; 'error.': 0.31; 'point': 0.33; 'stands': 0.33; 'equal': 0.34; 'previous': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'next': 0.35; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:209': 0.38; 'means': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'side': 0.62; 'subject: / ': 0.63; 'more': 0.63; 'results': 0.66; 'skip:6 10': 0.67; 'stated': 0.70; 'special': 0.73; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=nrE4x0M9+3cOHbZhbb39ycguBRzHrA/X5bKBrigB1fM=; b=wYy9taF9cnLyWs5fyH9QzVyNdOHPB0gnkaNlAD+rOKnE9NXshDsKXftjTPAiriIUO6 Wxn9gdDNhg4R3FGnigG9aECkBpeq1jYfHOTLau7dFO7Eyzo0Pk0f2p2fcuHIEaJNWQBi foVyVv/U0NLsY+FwwT6x8s6cFYOGVxkD5gwTIgr5cbo1olY3XmzdqAy3FA6AfHVpgCmt b/RbwXl2ko3UXhjuUiGNmfFkFzj/1OAAESCQtOhfeHUV1BGke637QcORZmWv7rCU9Vc8 7JVaCbVDl7qiHOri7A9WFn9B9Ddy93SQp51dmNpntO8dkBCcSAOdtdaDG1LcGSxXDKEW B6Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=nrE4x0M9+3cOHbZhbb39ycguBRzHrA/X5bKBrigB1fM=; b=bKl2kzDT+NuajgcSRbgKiMWBt6t0DlxhQCrIngky0ccfpD1FMh2tmLoPhfaRRld4NS AUENrLcomM5FrxarGByIgC77PP/TlIbTja5laHTt7j8DwWCaEu+TIVpTRCURxzi4/qZK qUqVG8tGTL4Uc6sBUHdobzxxBCukKVTCBgifRd65sjLPEOGLMugIXocVk60slPbkYcdU LBRqULfr3dF8KFuZ1+5cO/QBhbrd2AWObOIU7DcoCj+Z0WGoPY+WixtntGLrd8XYx5Gf inhxNS7hyzhSLm436s7mtnlf1pGR0qkO/4I1KdUiYlfTBdaXr1oGVSsv7aOEg+rTpjCH W9AQ== X-Gm-Message-State: ALyK8tJ9eimcxICsOijpRqYJ4bpWsFHFjdBmab+HYLbKdbejoyJWN4dRHu3tC6r472jD3f20Fkq/nk7mEeSUsw== X-Received: by 10.202.214.208 with SMTP id n199mr1341973oig.144.1464031510373; Mon, 23 May 2016 12:25:10 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <57422e03$0$1596$c3e8da3$5496439d@news.astraweb.com> <85r3ct9zt2.fsf@benfinney.id.au> <5742bacb$0$1526$c3e8da3$5496439d@news.astraweb.com> <87zirgrgol.fsf@bsb.me.uk> Xref: csiph.com comp.lang.python:109020 On Mon, May 23, 2016 at 12:16 PM, Pete Forman wrote: > Something else which I do not think has been stated yet in this thread > is that floating point is an inexact representation. Just because > integers and binary fractions have an exact correspondence we ought not > to be affording them special significance. Floating point 1 is not the > integer 1, it stands for a range of numbers some fraction either side of > 1. This is not the case. Floating point 1 means exactly 1, no more and no less. Results that aren't exactly representable get rounded to values that are, but this does not imply that the value once rounded is inexact. The value that 1/3 gets rounded to is exactly equal to 6004799503160661 / 18014398509481984, no more and no less. Treating floating point values as inexact would require an accumulation of the range of error. Otherwise, it would no longer be correct to say that 1.0 * 1.0 == 1.0. The result could with equal correctness be the next floating point number after 1.0, or the previous value before 1.0. Continue multiplying by 1.0 and the error creeps larger and larger. The defined result of the operation, however, is the exact value 1.0.