[issue1879] sqrt(-1) doesn't raise ValueError on OS X

David Kwast report at bugs.python.org
Sun Feb 24 02:57:00 CET 2008


David Kwast added the comment:

On OSX 10.5 this behavior is confirmed (Python2.5 and 2.6a). This fix 
appears to be a good fix for python 2.6a.

(Python 2.6a with patch applied)
Python 2.6a0 (trunk:60977M, Feb 23 2008, 19:24:52) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import log,sqrt
>>> sqrt(-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: math domain error
>>> log(-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: math domain error

david-kwasts-macbook:python-trunk davidkwast$ ./python 
./Lib/test/test_math.py 
testAcos (__main__.MathTests) ... ok
testAsin (__main__.MathTests) ... ok
testAtan (__main__.MathTests) ... ok
testAtan2 (__main__.MathTests) ... ok
testCeil (__main__.MathTests) ... ok
testConstants (__main__.MathTests) ... ok
testCopysign (__main__.MathTests) ... ok
testCos (__main__.MathTests) ... ok
testCosh (__main__.MathTests) ... ok
testDegrees (__main__.MathTests) ... ok
testExp (__main__.MathTests) ... ok
testFabs (__main__.MathTests) ... ok
testFloor (__main__.MathTests) ... ok
testFmod (__main__.MathTests) ... ok
testFrexp (__main__.MathTests) ... ok
testHypot (__main__.MathTests) ... ok
testIsinf (__main__.MathTests) ... ok
testIsnan (__main__.MathTests) ... ok
testLdexp (__main__.MathTests) ... ok
testLog (__main__.MathTests) ... ok
testLog10 (__main__.MathTests) ... ok
testModf (__main__.MathTests) ... ok
testPow (__main__.MathTests) ... ok
testRadians (__main__.MathTests) ... ok
testSin (__main__.MathTests) ... ok
testSinh (__main__.MathTests) ... ok
testSqrt (__main__.MathTests) ... ok
testTan (__main__.MathTests) ... ok
testTanh (__main__.MathTests) ... ok
test_exceptions (__main__.MathTests) ... ok
test_trunc (__main__.MathTests) ... ok

----------------------------------------------------------------------
Ran 31 tests in 0.011s

OK

----------
nosy: +david.kwast
versions:  -Python 2.5, Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1879>
__________________________________


More information about the Python-bugs-list mailing list