Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'float': 0.07; 'consistency': 0.09; 'undefined': 0.09; 'python': 0.11; '754': 0.16; 'inf': 0.16; 'nowadays': 0.16; 'reason.': 0.16; 'unambiguous': 0.16; 'undefined.': 0.16; 'zero,': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'integer': 0.24; 'switch': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'fixed': 0.29; 'raise': 0.29; 'operations,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'usually': 0.31; 'about.': 0.31; 'division': 0.31; 'maybe': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'granted': 0.65; 'results': 0.69; 'jul': 0.74; 'subject:For': 0.78 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=3kHO5U3oDLD0BRytAAlAA5lmO4zJHPN8Aki3rLlPPDg=; b=Zqrrb9yZ8m6WKeaw7swx1Tq5U0canGQkoghy1JKvAurgG5MaV6MvBBMbTaNJrFfxbr 6fA1F2WGCEi5n6CjprhjUbJaW+cSMlfV+jjCPW/ftyfUAQgvewWaslanrhre6DOli5p7 aro7hC8gGNlD3InO+5CcJIRWCQI8itd7OJmfIUplbl0xhRlVYH60ISHUVtEUjNbMBqe4 oCZ1IQb8TMnfVoxXX+cBT1sV7Y6j98R0kpTD9M3Z5oZkim1JilKL4WOIb83NU1Xshv2r G5ADc+btrHdaAxUk+80hUsn1mV82BP8ebIW8WWjxPMlMmnMATUu+Zfuixs2qQuKttf5z hGIw== X-Received: by 10.66.237.2 with SMTP id uy2mr4856178pac.157.1405629623137; Thu, 17 Jul 2014 13:40:23 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <877g3b244v.fsf@elektro.pacujo.net> References: <53BC05FB.4050707@jmunch.dk> <53BD70F4.4000504@stoneleaf.us> <53BDAF90.8010709@jmunch.dk> <877g3b244v.fsf@elektro.pacujo.net> From: Ian Kelly Date: Thu, 17 Jul 2014 14:39:42 -0600 Subject: Re: NaN comparisons - Call For Anecdotes 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: 1405629625 news.xs4all.nl 2952 [2001:888:2000:d::a6]:51108 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74690 On Thu, Jul 17, 2014 at 1:10 PM, Marko Rauhamaa wrote: > Mathematically, there are undefined operations, for a good reason. > That's because the limits are not unambiguous and that's why 0/0, 0**0, > 1/0 and inf-inf are undefined. Well, 0**0 is usually defined as 1, despite the limits being ambiguous. Also, 1/0 in IEEE 754 is defined as inf. > Why 0/0 results in an exception but inf-inf = nan, I don't see a > justification. I expect that float division by zero was made to raise an exception for consistency with integer division by zero, where it might be considered inappropriate to switch types and return inf or nan. Granted that nowadays integer division returns a float anyway, but there is still floor division to think about. Maybe this should have been fixed in Python 3, but it wasn't.