Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.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; 'argument': 0.05; 'true,': 0.05; 'subject:Why': 0.09; '42,': 0.16; 'all).': 0.16; 'division.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'mod': 0.31; 'sep': 0.31; '(i.e.': 0.33; 'could': 0.34; 'agree': 0.35; 'received:google.com': 0.35; 'there': 0.35; "didn't": 0.36; 'possible': 0.36; 'should': 0.36; 'too': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'talking': 0.65 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=fndqmnQxSvp0Y41CfYV+L4+8Z/FAp6hKI9o9TMzj7YA=; b=TtaBWNj3f0FV0rDj+lz/dyRChREoH2gdz0w2ZN2wv+pQSjcGoWpGO0i3WF2ghL6r6v Zoumvh8tG0RwFc0BbUUH6u6TPK5Y4eWZeiH84XGbXd6C1aYbgAJoG9Fd9xarDUN/4biR oH/j12k4oAE9IXsyghpEgt4h1nfzo+U+zTtZGazQUtabYh4Gmmh9NgV4h9X8Qoft1atl 8Tszkkg9LfYTABZg+vlBo8TsUazqPKXqmeG0QbmX+kie5VnfLXdK59a4HuHuivdSe7B+ nVvzklmT6E0N5w9DrVJfmvhDbAUox7mlLzU03GPy7+hqbNDHHKwa1v4sm7LEx0mXz/CU plLQ== X-Received: by 10.180.9.37 with SMTP id w5mr6406858wia.39.1410968094381; Wed, 17 Sep 2014 08:34:54 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <06397cb3-8baf-4af1-8152-ff7c3f6ceb62@googlegroups.com> <151e45ce-444d-441c-b59b-67e2aee3882b@googlegroups.com> From: Ian Kelly Date: Wed, 17 Sep 2014 09:34:14 -0600 Subject: Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410968095 news.xs4all.nl 2948 [2001:888:2000:d::a6]:51476 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77969 On Wed, Sep 17, 2014 at 9:29 AM, Chris Angelico wrote: > On Thu, Sep 18, 2014 at 1:16 AM, cool-RR 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).