Bugs item #1678380, was opened at 2007-03-11 18:16 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678380&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: None >Status: Pending >Resolution: Wont Fix Priority: 5 Private: No Submitted By: Mark Dickinson (marketdickinson) Assigned to: Nobody/Anonymous (nobody) Summary: 0.0 and -0.0 identified, with surprising results Initial Comment: The identification of -0.0 and 0.0 in scripts leads to some surprising results. In particular, code that behaves one way in the interpreter can behave differently in a script. For example: Python 2.6a0 (trunk:54183M, Mar 6 2007, 20:16:00) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from math import atan2; >>> x = -0. >>> y = 0. >>> print atan2(y, -1.) 3.14159265359 But: >>> exec("from math import atan2; x = -0.; y = 0.; print atan2(y, -1.)") -3.14159265359 A simpler example: >>> x, y = -0., 0. >>> x, y (-0.0, -0.0) >>> id(x) == id(y) True But: >>> x = -0. >>> y = 0. >>> x, y (-0.0, 0.0) This occurs both on SuSE Linux 9.3/i686 and on OS X 10.4.8/PowerPC. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2007-03-11 19:35 Message: Logged In: YES user_id=21627 Originator: NO This is not a bug, at least not one that will be fixed. Details of the floating-point can vary across platforms, and they may behave in suprising ways in various contexts. Users shouldn't rely on Python differentiating between -0 and +0. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1678380&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com