signum() not in math?

Harald Hanche-Olsen hanche at math.ntnu.no
Fri Oct 12 18:05:04 EDT 2001


+ Dinu Gherman <gherman at darwin.in-berlin.de>:

| no worries, there doesn't 
| seem to be any such difference between -0 and +0 in Python:
| 
| PythonWin 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on
| win32.
| >>> -0 < +0
| 0
| >>> -0 > +0
| 0
| >>> -0 == +0
| 1
| >>> -0. == +0.
| 1
| >>> -0. < +0.
| 0
| >>> -0. < +0
| 0

Wrong tests. In fact, it is quite difficult to see the difference
between the two zeros, but on the Intel architecture, they are
different indeed:

>>> import math
>>> math.atan2(0.,-1.)
3.1415926535897931
>>> math.atan2(-0.,-1.)
-3.1415926535897931

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Yes it works in practice - but does it work in theory?



More information about the Python-list mailing list