Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77977
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'true,': 0.05; 'element': 0.07; 'exception.': 0.09; 'subject:Why': 0.09; '*only*': 0.16; '1),': 0.16; '42,': 0.16; 'all).': 0.16; 'division.': 0.16; 'inf': 0.16; 'nan': 0.16; 'reason.': 0.16; 'tuple.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'thu,': 0.19; '>>>': 0.22; 'focusing': 0.24; 'possibly': 0.26; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'raise': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; '>>>>': 0.31; 'mod': 0.31; 'sep': 0.31; "we're": 0.32; '(i.e.': 0.33; 'could': 0.34; "can't": 0.35; 'agree': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'maintained': 0.36; 'returning': 0.36; "didn't": 0.36; 'possible': 0.36; 'should': 0.36; 'example,': 0.37; 'wrong': 0.37; 'too': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; 'talking': 0.65; 'actually,': 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 :content-type; bh=0BZFMlhS0NivuSBEqStEWnni51YpLA5np7QpOTHlfPI=; b=qUffmvbqRKRe2DaTB+VxMUISRD6PqoizHmssBJL/KD3YVrGNCE6/lvJio3jHNK07JA 76UKtPHP1OI/DLG3Yb86SNP4VTQ5FflCWcRvjo2DZE/6F2PxChNZtvxj4scPRue7b3SQ p5Rk4o0Q38qpEjEE12m0DnYLE/kaUhR/NV+T3m9QONoJXn9ciOPGU8MWFoAhWGnLVzdk REIScWNELe9Aw2VBGoWUlE4nU2+mm9Ii+gvlHnYe/KyhzO2I2bwsLfksZ1C2M5Mz37qu HrJ0y3+vV5QwNXSVsGJXKSFXzlRbsiFqy0SVE73FS3mb1RHZnFdGmmk6HpzG24rlpS9s 2l2w== |
| X-Received | by 10.180.211.36 with SMTP id mz4mr42088861wic.39.1410971463864; Wed, 17 Sep 2014 09:31:03 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <CAPTjJmqN26=Fk4+i-az38E_0UwLP=gFPiuGNjxG8OXOp8_W=4w@mail.gmail.com> |
| References | <06397cb3-8baf-4af1-8152-ff7c3f6ceb62@googlegroups.com> <mailman.14066.1410916403.18130.python-list@python.org> <fd859066-7068-4a43-a9f0-0e9cc6949cf6@googlegroups.com> <mailman.14076.1410966617.18130.python-list@python.org> <151e45ce-444d-441c-b59b-67e2aee3882b@googlegroups.com> <CAPTjJmrT3if7JU8Z2T6VNPrG53m+yCU5FueO4UOH=Gc3gY8PMA@mail.gmail.com> <CALwzid==LQ0af8x_ULctsoGqe9ngC=JpdXC8g_YqrDhajm5m9g@mail.gmail.com> <CAPTjJmqN26=Fk4+i-az38E_0UwLP=gFPiuGNjxG8OXOp8_W=4w@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 17 Sep 2014 10:30:23 -0600 |
| Subject | Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14084.1410971471.18130.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1410971471 news.xs4all.nl 2872 [2001:888:2000:d::a6]:49607 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:77977 |
Show key headers only | View raw
On Wed, Sep 17, 2014 at 9:40 AM, Chris Angelico <rosuav@gmail.com> wrote: > On Thu, Sep 18, 2014 at 1:34 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: >> On Wed, Sep 17, 2014 at 9:29 AM, Chris Angelico <rosuav@gmail.com> wrote: >>> On Thu, Sep 18, 2014 at 1:16 AM, cool-RR <ram.rachum@gmail.com> wrote: >>>> I didn't ask for the modulo, I agree it should remain NaN. I'm talking about the floor division. >>>> >>> >>> Invariant: div*y + mod == x. >>> >>> If mod is NaN, there is no possible value for div that will make the >>> invariant true, ergo it too has to be NaN. >> >> That still doesn't make the invariant true. By this argument div could >> be 42, and the invariant would hold equally well (i.e. not at all). > > Nothing can possibly make it true, so there are only two > possibilities: return NaN, or raise an exception. Actually, I think we're focusing on the wrong element of the tuple. The fact is that there are values that can make the invariant true. For example, divmod(inf, 1) could return (inf, 0). inf * 1 + 0 = inf. (inf, 1), or (inf, <any finite value>) would work equally well. The *only* reason the invariant can't be maintained is because we're committed to returning nan for the second element for some reason.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` cool-RR <ram.rachum@gmail.com> - 2014-09-16 14:40 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Terry Reedy <tjreedy@udel.edu> - 2014-09-16 21:12 -0400
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` cool-RR <ram.rachum@gmail.com> - 2014-09-17 07:55 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 01:10 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` cool-RR <ram.rachum@gmail.com> - 2014-09-17 08:16 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 01:29 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` cool-RR <ram.rachum@gmail.com> - 2014-09-17 09:33 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 02:37 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-18 13:11 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` cool-RR <ram.rachum@gmail.com> - 2014-09-18 01:43 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-17 09:34 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 01:40 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-18 12:50 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-17 10:12 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-17 10:30 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-17 12:03 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 07:37 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-18 13:29 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Chris Angelico <rosuav@gmail.com> - 2014-09-18 13:47 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Terry Reedy <tjreedy@udel.edu> - 2014-09-17 19:23 -0400
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-18 00:51 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-17 09:35 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` wxjmfauth@gmail.com - 2014-09-17 23:22 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Marko Rauhamaa <marko@pacujo.net> - 2014-09-18 09:45 +0300
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` wxjmfauth@gmail.com - 2014-09-18 00:13 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-18 19:25 +1000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` wxjmfauth@gmail.com - 2014-09-18 05:57 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Grant Edwards <invalid@invalid.invalid> - 2014-09-18 14:33 +0000
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` chris.barker@noaa.gov - 2014-09-18 09:35 -0700
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-18 11:05 -0600
Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` wxjmfauth@gmail.com - 2014-09-18 23:48 -0700
csiph-web