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.

classification
Title: tes_math fails Mac OS X 10.4 due to OverflowError in test_mtestfile
Type: behavior Stage:
Components: Tests Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: mark.dickinson, slmnhq
Priority: normal Keywords: patch

Created on 2009-12-24 16:02 by slmnhq, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue7575.patch mark.dickinson, 2009-12-24 19:21
Messages (8)
msg96860 - (view) Author: Salman Haq (slmnhq) Date: 2009-12-24 16:02
See output of regrtest below. It was run on an Intel Mac OS X 10.4

A similar failure is observed on the py3k branch.

./python.exe Lib/test/regrtest.py -v test_math

test_math
testAcos (test.test_math.MathTests) ... ok
testAcosh (test.test_math.MathTests) ... ok
testAsin (test.test_math.MathTests) ... ok
testAsinh (test.test_math.MathTests) ... ok
testAtan (test.test_math.MathTests) ... ok
testAtan2 (test.test_math.MathTests) ... ok
testAtanh (test.test_math.MathTests) ... ok
testCeil (test.test_math.MathTests) ... ok
testConstants (test.test_math.MathTests) ... ok
testCopysign (test.test_math.MathTests) ... ok
testCos (test.test_math.MathTests) ... ok
testCosh (test.test_math.MathTests) ... ok
testDegrees (test.test_math.MathTests) ... ok
testExp (test.test_math.MathTests) ... ok
testFabs (test.test_math.MathTests) ... ok
testFactorial (test.test_math.MathTests) ... ok
testFloor (test.test_math.MathTests) ... ok
testFmod (test.test_math.MathTests) ... ok
testFrexp (test.test_math.MathTests) ... ok
testFsum (test.test_math.MathTests) ... ok
testHypot (test.test_math.MathTests) ... ok
testIsinf (test.test_math.MathTests) ... ok
testIsnan (test.test_math.MathTests) ... ok
testLdexp (test.test_math.MathTests) ... ok
testLog (test.test_math.MathTests) ... ok
testLog10 (test.test_math.MathTests) ... ok
testLog1p (test.test_math.MathTests) ... ok
testModf (test.test_math.MathTests) ... ok
testPow (test.test_math.MathTests) ... ok
testRadians (test.test_math.MathTests) ... ok
testSin (test.test_math.MathTests) ... ok
testSinh (test.test_math.MathTests) ... ok
testSqrt (test.test_math.MathTests) ... ok
testTan (test.test_math.MathTests) ... ok
testTanh (test.test_math.MathTests) ... ok
test_exceptions (test.test_math.MathTests) ... ok
test_mtestfile (test.test_math.MathTests) ... FAIL
test_testfile (test.test_math.MathTests) ... ok
test_trunc (test.test_math.MathTests) ... ok
Doctest: ieee754.txt ... ok

======================================================================
FAIL: test_mtestfile (test.test_math.MathTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/salman/svn/python/trunk/Lib/test/test_math.py", line
1016, in test_mtestfile
    '\n  '.join(failures))
AssertionError: Failures in test_mtestfile:
  expm10302:expm1(709.7827128932839): expected 1.797693134682424e+308,
got 'OverflowError'

----------------------------------------------------------------------
Ran 40 tests in 2.273s

FAILED (failures=1)
test test_math failed -- Traceback (most recent call last):
  File "/Users/salman/svn/python/trunk/Lib/test/test_math.py", line
1016, in test_mtestfile
    '\n  '.join(failures))
AssertionError: Failures in test_mtestfile:
  expm10302:expm1(709.7827128932839): expected 1.797693134682424e+308,
got 'OverflowError'

1 test failed:
    test_math
msg96862 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-24 16:17
Salman Haq also reported (on IRC) that the configure output shows:

checking for expm1... yes

so this appears to be a problem with the platform's implementation of 
expm1, rather than with Python's expm1 code (which is only used when the 
platform version isn't available).
msg96866 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-24 17:17
This seems to be specific to OS X/Intel:  I'm not seeing any failure on my 
ancient iBook G4 (OS X 10.4.11).
msg96867 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-24 17:24
Salman Haq, could you find out roughly where expm1 starts overflowing on 
your machine?  E.g., do all of the following overflow for you?

>>> from math import expm1
>>> expm1(709.78271289338397)
1.7976931348622732e+308
>>> expm1(709.782712893)
1.797693134172102e+308
>>> expm1(709.7827)
1.7976699566638014e+308
>>> expm1(709.7)
1.6549840276802644e+308

I'm just trying to determine whether the 10.4 expm1 is so broken that 
Python should work around it, or whether it's only slightly broken.  In 
the latter case we can just live with it, and either weaken the tests 
slightly or explicitly skip that particularly test on OS X 10.4.
msg96868 - (view) Author: Salman Haq (slmnhq) Date: 2009-12-24 17:38
Only the argument with one decimal place precision does NOT overflow.

Python 2.7a1+ (trunk:76872, Dec 21 2009, 09:54:29) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import expm1
>>> expm1(709.78271289338397)     
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> expm1(709.782712893)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> expm1(709.7827)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> expm1(709.782)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> expm1(709.78)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error
>>> expm1(709.7)
1.6549840276802644e+308
msg96869 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-24 19:15
Thanks for that.  I'd call that pretty broken then:  the result of 
expm1(709.78) is effectively wrong by 24.4 trillion ulps (perhaps that 
should be 24.4 teraulps?).  I guess someone just coded a hard cutoff value 
somewhere between 709.7 and 709.78.

But since anyone getting this close to overflow is asking for trouble 
anyway, perhaps the easiest solution is just to change the test to test a 
value not quite as close to the overflow boundary.
msg96870 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-24 19:21
Here's a patch (against trunk).
msg97002 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-29 20:53
Fixed in r77116 (trunk), r77117 (py3k).
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51824
2009-12-29 20:53:55mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg97002
2009-12-24 19:21:59mark.dickinsonsetfiles: + issue7575.patch
keywords: + patch
messages: + msg96870
2009-12-24 19:15:49mark.dickinsonsetmessages: + msg96869
2009-12-24 17:38:35slmnhqsetmessages: + msg96868
2009-12-24 17:24:57mark.dickinsonsetmessages: + msg96867
2009-12-24 17:17:08mark.dickinsonsetmessages: + msg96866
2009-12-24 16:26:40mark.dickinsonsetversions: + Python 3.2
2009-12-24 16:17:21mark.dickinsonsetmessages: + msg96862
2009-12-24 16:07:55mark.dickinsonsetpriority: normal
assignee: mark.dickinson

type: performance -> behavior
nosy: + mark.dickinson
2009-12-24 16:02:59slmnhqcreate