Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:: [': 0.04; 'languages,': 0.04; 'subject:Python': 0.06; 'nasty': 0.07; 'referring': 0.07; 'anders': 0.09; 'things,': 0.09; 'valueerror:': 0.09; 'nan': 0.16; 'nans': 0.16; 'subject:Dev': 0.16; 'subject:object': 0.16; 'tradeoffs': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'error': 0.23; 'choices': 0.24; 'math': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; '"",': 0.31; '>>>>': 0.31; 'ctypes': 0.31; "d'aprano": 0.31; 'implied': 0.31; 'steven': 0.31; 'file': 0.32; 'skip:c 30': 0.32; '(most': 0.33; 'received:google.com': 0.35; 'false': 0.36; 'e.g.': 0.38; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'different': 0.65; 'jul': 0.74 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=uP+6yi/JWKNc7QVLnYdyA+U+V7z0J7Gupcjicwyz/tQ=; b=cJklq2iKTr3oDqWK3x9fD9I3KDhBivd/7Ti4LKL6xGA7WmN2gFXXBAZLLLadMI0Qe0 DXIM/bFbzzPe/yN4w+D4qs+nLfIyG7k5mS79sWIV4MgJRrRzz6errvzgb/XnKm3Pk18Y UjvKkt1rWD+6HAWtGuh9sT9e5HYLdquHP43K9jp/9ytGP3iNAAYK00tVJUddDgVu/jw2 Y+l4uadtmUHVKwS1EmgQcaVXM+WdFIAuhcQhaRLFa+F6MlS86cyRZ4RR3NuTmrnsoHId 1zsXpnsqnRjoWmnbvgUk853I2QSwbw7d+Z9JAn/COiQKXqjx+k5WRwPb35070vVfr1D6 hpqg== X-Received: by 10.70.131.134 with SMTP id om6mr7322631pdb.95.1404856424654; Tue, 08 Jul 2014 14:53:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <53BC5053.1010904@jmunch.dk> References: <53BB2AC7.2060009@gmx.de> <53BB2F25.3020205@gmx.de> <53BB5082.500@btinternet.com> <20140708031202.GF13014@ando> <53BB6D5F.1010800@btinternet.com> <87a98ktjv7.fsf@uwakimon.sk.tsukuba.ac.jp> <8761j8thf5.fsf@uwakimon.sk.tsukuba.ac.jp> <20140708165745.GJ13014@ando> <53BC5053.1010904@jmunch.dk> From: Ian Kelly Date: Tue, 8 Jul 2014 15:53:04 -0600 Subject: Re: [Python-Dev] == on object tests identity in 3.x 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404856432 news.xs4all.nl 2896 [2001:888:2000:d::a6]:48470 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74212 On Tue, Jul 8, 2014 at 2:10 PM, Anders J. Munch <2014@jmunch.dk> wrote: > Steven D'Aprano wrote: >> - Keeping reflexivity for NANs would have implied some pretty nasty >> things, e.g. if log(-3) == log(-5), then -3 == -5. > > >>>> log(-3) > Traceback (most recent call last): > File "", line 1, in > ValueError: math domain error > > You were perhaps referring to the log functions in C and Fortran, not > math.log? > The tradeoffs are different in those languages, so choices the IEEE-754 > committee made with C and Fortran in mind may be less relevant for Python. >>> import ctypes >>> libm = ctypes.cdll.LoadLibrary("libm.so.6") >>> log = libm.log >>> log.argtypes = [ctypes.c_double] >>> log.restype = ctypes.c_double >>> log(-3) nan >>> log(-5) nan >>> log(-3) == log(-5) False