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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'jan': 0.12; 'constructs.': 0.16; 'definition.': 0.16; 'inf': 0.16; 'nan': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'choices': 0.24; 'engineering,': 0.24; 'mathematical': 0.24; 'math': 0.24; 'question': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'another': 0.32; '(including': 0.33; 'there': 0.35; 'really': 0.36; 'consistent': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'back': 0.62; 'real': 0.63; 'received:fios.verizon.net': 0.84; 'why?': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))` Date: Wed, 17 Sep 2014 19:23:51 -0400 References: <06397cb3-8baf-4af1-8152-ff7c3f6ceb62@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410996269 news.xs4all.nl 2852 [2001:888:2000:d::a6]:35968 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77986 On 9/17/2014 10:55 AM, cool-RR wrote: > Terry, that doesn't really answer the question "why", it just pushes > it back to the documentation. Is there a real answer why? Why return > NaN when Inf would make mathematical sense? IEEE float('inf') and float('nan') are engineering, not math constructs. I showed that the result is consistent with the math definition. Another result (including raising) might be also. Many choices concerting inf and nan are arbitrary and any 'why' can be debated. -- Terry Jan Reedy