Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; '(at': 0.04; 'float': 0.07; 'subject:Why': 0.09; 'infinity': 0.16; 'nan': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'integer': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '"",': 0.31; '>>>>': 0.31; 'sep': 0.31; 'file': 0.32; '(most': 0.33; 'convert': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39 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=iUtIHMYs0msaReNkFqZffpM3VIOkrkjxV4wfBlFlwqE=; b=B0q8M8cWxTwxEZd76j6YO5rvFMw4XkOnnLl6Vv4tJ6wWPq0dma/X8ZT4m2VzP1ehyv BwGkzNkg93KPSuBYfI2dhyUCvuPrLwiqvuEEGhStLoie57kVcjvzN9gD4e1ruahD50MQ v6WLl/g9Zhr2uDcFKTB4lbQ9doLr71Jofx2Bh65SRCC+YXsi4VhKPxvMFnRtMMmoyqwf BKTh/xdFSak7BfQpOMLu97b5rixyvhCyynEAjyeZbb3MVzIm41CIImMObdKtBMQDLvVu 2+RGUQ7tZ3MqRnqeotiCMwXib3JZlbho7nW+M4l/EGovQZ/H/4bsipEBxaI6aeO+tEli Wp6Q== X-Received: by 10.194.78.4 with SMTP id x4mr51901938wjw.44.1410968194282; Wed, 17 Sep 2014 08:36:34 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <06397cb3-8baf-4af1-8152-ff7c3f6ceb62@googlegroups.com> From: Ian Kelly Date: Wed, 17 Sep 2014 09:35:54 -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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410968195 news.xs4all.nl 2944 [2001:888:2000:d::a6]:53477 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77970 On Tue, Sep 16, 2014 at 7:12 PM, Terry Reedy wrote: > It does not really matter, however, as infinity cannot be 'floored' as > required for // > >>>> math.floor(float('inf')) > Traceback (most recent call last): > File "", line 1, in > math.floor(float('inf')) > OverflowError: cannot convert float infinity to integer > > and hence > >>>> float('inf') // 1.0 > nan In C, floor(INFINITY) returns infinity (at least in the implementation I just tested).