This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson
Date 2008-01-21.02:51:25
SpamBayes Score 0.0023285106
Marked as misclassified No
Message-id <1200883888.97.0.437374079609.issue1879@psf.upfronthosting.co.za>
In-reply-to
Content
On OS X 10.4, and probably other versions of OS X too, calls to math.log and math.sqrt that 
should raise ValueError instead return a NaN:

Python 2.6a0 (trunk:60144, Jan 20 2008, 21:43:56) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import sqrt, log 
>>> sqrt(-1)
nan
>>> log(-1)
nan

The problem is that OS X doesn't set errno in these cases.  Attached is a quick fix for this.  
Note that there's already a test for this (test_exceptions in test_math.py), but this test is 
only run in verbose mode.

See also issue #871657.
History
Date User Action Args
2008-01-21 02:51:29mark.dickinsonsetspambayes_score: 0.00232851 -> 0.0023285106
recipients: + mark.dickinson
2008-01-21 02:51:29mark.dickinsonsetspambayes_score: 0.00232851 -> 0.00232851
messageid: <1200883888.97.0.437374079609.issue1879@psf.upfronthosting.co.za>
2008-01-21 02:51:27mark.dickinsonlinkissue1879 messages
2008-01-21 02:51:26mark.dickinsoncreate