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 djmdjm
Recipients djmdjm
Date 2008-08-26.00:03:41
SpamBayes Score 9.666427e-09
Marked as misclassified No
Message-id <1219709028.38.0.6245780787.issue3682@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,

On OpenBSD 4.4, the test_math.py regression test fails with the following:

Traceback (most recent call last):
  File "Lib/test/test_math.py", line 419, in testLog
    self.assertRaises(ValueError, math.log, NINF)
AssertionError: ValueError not raised

This is because libm's log function does not return NaN when passed
-INFINITY. It returns -INFINITY and sets EDOM. This behaviour seems to
be permitted by the C99 spec (ISO/IEC 9899:1999):

> 7.12.1 Treatment of error conditions
> paragraph2:
> ... On a domain error, the function returns an implementation-defined
> value; if the integer expression math_errhandling & MATH_ERRNO is 
> nonzero, the integer expression errno acquires the value EDOM; 

in mathmodule.c:math_1() errno seems to be deliberately ignored when the
result is infinite. The attached patch modified math_1() to retain EDOM
errors for infinite results.
History
Date User Action Args
2008-08-26 00:03:50djmdjmsetrecipients: + djmdjm
2008-08-26 00:03:48djmdjmsetmessageid: <1219709028.38.0.6245780787.issue3682@psf.upfronthosting.co.za>
2008-08-26 00:03:46djmdjmlinkissue3682 messages
2008-08-26 00:03:43djmdjmcreate