|
37 | 37 | math_testcases = os.path.join(test_dir, 'mathdata', 'math_testcases.txt') |
38 | 38 | test_file = os.path.join(test_dir, 'mathdata', 'cmath_testcases.txt') |
39 | 39 |
|
| 40 | +skip_on_newlib = unittest.skipIf(sys.platform == 'cygwin', |
| 41 | + 'the test fails on newlib C library') |
| 42 | + |
40 | 43 |
|
41 | 44 | def to_ulps(x): |
42 | 45 | """Convert a non-NaN float x to an integer, in such a way that |
@@ -922,6 +925,7 @@ def testHypot(self): |
922 | 925 | @requires_IEEE_754 |
923 | 926 | @unittest.skipIf(HAVE_DOUBLE_ROUNDING, |
924 | 927 | "hypot() loses accuracy on machines with double rounding") |
| 928 | + @skip_on_newlib |
925 | 929 | def testHypotAccuracy(self): |
926 | 930 | # Verify improved accuracy in cases that were known to be inaccurate. |
927 | 931 | # |
@@ -1244,6 +1248,7 @@ def testLog1p(self): |
1244 | 1248 | self.assertEqual(math.log1p(INF), INF) |
1245 | 1249 |
|
1246 | 1250 | @requires_IEEE_754 |
| 1251 | + @skip_on_newlib |
1247 | 1252 | def testLog2(self): |
1248 | 1253 | self.assertRaises(TypeError, math.log2) |
1249 | 1254 |
|
@@ -1276,6 +1281,7 @@ def testLog2(self): |
1276 | 1281 | @requires_IEEE_754 |
1277 | 1282 | # log2() is not accurate enough on Mac OS X Tiger (10.4) |
1278 | 1283 | @support.requires_mac_ver(10, 5) |
| 1284 | + @skip_on_newlib |
1279 | 1285 | def testLog2Exact(self): |
1280 | 1286 | # Check that we get exact equality for log2 of powers of 2. |
1281 | 1287 | actual = [math.log2(math.ldexp(1.0, n)) for n in range(-1074, 1024)] |
@@ -2615,6 +2621,7 @@ def test_fma_nan_results(self): |
2615 | 2621 | self.assertIsNaN(math.fma(a, math.nan, b)) |
2616 | 2622 | self.assertIsNaN(math.fma(a, b, math.nan)) |
2617 | 2623 |
|
| 2624 | + @skip_on_newlib |
2618 | 2625 | def test_fma_infinities(self): |
2619 | 2626 | # Cases involving infinite inputs or results. |
2620 | 2627 | positives = [1e-300, 2.3, 1e300, math.inf] |
@@ -2685,7 +2692,7 @@ def test_fma_infinities(self): |
2685 | 2692 | # gh-73468: On some platforms, libc fma() doesn't implement IEE 754-2008 |
2686 | 2693 | # properly: it doesn't use the right sign when the result is zero. |
2687 | 2694 | @unittest.skipIf( |
2688 | | - sys.platform.startswith(("freebsd", "wasi", "netbsd", "emscripten")) |
| 2695 | + sys.platform.startswith(("freebsd", "wasi", "netbsd", "emscripten", "cygwin")) |
2689 | 2696 | or (sys.platform == "android" and platform.machine() == "x86_64") |
2690 | 2697 | or support.linked_to_musl(), # gh-131032 |
2691 | 2698 | f"this platform doesn't implement IEE 754-2008 properly") |
@@ -2743,6 +2750,7 @@ def test_fma_zero_result(self): |
2743 | 2750 | self.assertIsNegativeZero(math.fma(y-x, -(x+y), -z)) |
2744 | 2751 | self.assertIsPositiveZero(math.fma(x-y, -(x+y), z)) |
2745 | 2752 |
|
| 2753 | + @skip_on_newlib |
2746 | 2754 | def test_fma_overflow(self): |
2747 | 2755 | a = b = float.fromhex('0x1p512') |
2748 | 2756 | c = float.fromhex('0x1p1023') |
@@ -2776,10 +2784,12 @@ def test_fma_overflow(self): |
2776 | 2784 | c = float.fromhex('0x1.fffffffffffffp+1023') |
2777 | 2785 | self.assertEqual(math.fma(a, b, -c), c) |
2778 | 2786 |
|
| 2787 | + @skip_on_newlib |
2779 | 2788 | def test_fma_single_round(self): |
2780 | 2789 | a = float.fromhex('0x1p-50') |
2781 | 2790 | self.assertEqual(math.fma(a - 1.0, a + 1.0, 1.0), a*a) |
2782 | 2791 |
|
| 2792 | + @skip_on_newlib |
2783 | 2793 | def test_random(self): |
2784 | 2794 | # A collection of randomly generated inputs for which the naive FMA |
2785 | 2795 | # (with two rounds) gives a different result from a singly-rounded FMA. |
|
0 commit comments