MCPcopy Index your code
hub / github.com/python/cpython / test_fma_nan_results

Method test_fma_nan_results

Lib/test/test_math.py:2604–2616  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2602 """ Tests for math.fma. """
2603
2604 def test_fma_nan_results(self):
2605 # Selected representative values.
2606 values = [
2607 -math.inf, -1e300, -2.3, -1e-300, -0.0,
2608 0.0, 1e-300, 2.3, 1e300, math.inf, math.nan
2609 ]
2610
2611 # If any input is a NaN, the result should be a NaN, too.
2612 for a, b in itertools.product(values, repeat=2):
2613 with self.subTest(a=a, b=b):
2614 self.assertIsNaN(math.fma(math.nan, a, b))
2615 self.assertIsNaN(math.fma(a, math.nan, b))
2616 self.assertIsNaN(math.fma(a, b, math.nan))
2617
2618 def test_fma_infinities(self):
2619 # Cases involving infinite inputs or results.

Callers

nothing calls this directly

Calls 3

assertIsNaNMethod · 0.95
subTestMethod · 0.45
fmaMethod · 0.45

Tested by

no test coverage detected