Message9295

Author zyasoft
Recipients jeff.allen, zyasoft
Date 2015-01-04.19:04:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420398295.45.0.50517775826.issue2244@psf.upfronthosting.co.za>
In-reply-to
Content
On OS X 10.10.1 (Mavericks), I needed a higher tolerance for one of the cosh computations:

======================================================================
FAIL: testCosh (__main__.MathAccuracy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jbaker/jythondev/jython27/dist/Lib/test/test_math.py", line 344, in testCosh
    self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
  File "dist/Lib/test/test_math_jy.py", line 59, in ftest
    self.fail(message)
AssertionError: cosh(2)-2*cosh(1)**2 returned -1.0000000000000009, expected -1

----------------------------------------------------------------------
Ran 43 tests in 3.688s

FAILED (failures=1)
Traceback (most recent call last):
  File "dist/Lib/test/test_math_jy.py", line 75, in <module>
    test_main()
  File "dist/Lib/test/test_math_jy.py", line 68, in test_main
    test_support.run_unittest(
  File "/Users/jbaker/jythondev/jython27/dist/Lib/test/test_support.py", line 1274, in run_unittest
    _run_suite(suite)
  File "/Users/jbaker/jythondev/jython27/dist/Lib/test/test_support.py", line 1257, in _run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File "/Users/jbaker/jythondev/jython27/dist/Lib/test/test_math.py", line 344, in testCosh
    self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
  File "dist/Lib/test/test_math_jy.py", line 59, in ftest
    self.fail(message)
AssertionError: cosh(2)-2*cosh(1)**2 returned -1.0000000000000009, expected -1

Likely this accuracy has been updated since release 21 (OS X), and before release 55 (Windows 8.1). However, checking the release notes (http://www.oracle.com/technetwork/java/javase/7u-relnotes-515228.html), I didn't see anything specific, likely because this change to cosh is too minor to be specifically addressed.

Using the latest version of each of our primary supported platforms, including all upgrades applied, here's what sys.platform reports:

OS X 10.10.1 - "java1.7.0_21"
Ubuntu 14.10 - "java1.7.0_60"
Windows 8.1 - "java1.7.0_55"

We may want to mark this as an expected failure in the regrtest, tied to the Java release (using sys.platform), but I don't think we should apply the below diff:

diff -r ea036792f304 Lib/test/test_math_jy.py
--- a/Lib/test/test_math_jy.py	Sun Jan 04 09:51:07 2015 -0700
+++ b/Lib/test/test_math_jy.py	Sun Jan 04 11:33:09 2015 -0700
@@ -48,7 +48,10 @@
     def ftest(self, name, value, expected):
         if expected != 0. :
             # Tolerate small deviation in proportion to expected
-            tol = Math.ulp(expected)
+            if name == 'cosh(2)-2*cosh(1)**2':
+                tol = Math.ulp(expected * 4)
+            else:
+                tol = Math.ulp(expected)
         else :
             # On zero, allow 2**-52. Maybe allow different slack based on name
             tol = Math.ulp(1.)
History
Date User Action Args
2015-01-04 19:04:55zyasoftsetmessageid: <1420398295.45.0.50517775826.issue2244@psf.upfronthosting.co.za>
2015-01-04 19:04:55zyasoftsetrecipients: + zyasoft, jeff.allen
2015-01-04 19:04:55zyasoftlinkissue2244 messages
2015-01-04 19:04:54zyasoftcreate