MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_fma_nan_results

Method test_fma_nan_results

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

Source from the content-addressed store, hash-verified

2695 """ Tests for math.fma. """
2696
2697 def test_fma_nan_results(self):
2698 # Selected representative values.
2699 values = [
2700 -math.inf, -1e300, -2.3, -1e-300, -0.0,
2701 0.0, 1e-300, 2.3, 1e300, math.inf, math.nan
2702 ]
2703
2704 # If any input is a NaN, the result should be a NaN, too.
2705 for a, b in itertools.product(values, repeat=2):
2706 with self.subTest(a=a, b=b):
2707 self.assertIsNaN(math.fma(math.nan, a, b))
2708 self.assertIsNaN(math.fma(a, math.nan, b))
2709 self.assertIsNaN(math.fma(a, b, math.nan))
2710
2711 def test_fma_infinities(self):
2712 # Cases involving infinite inputs or results.

Callers

nothing calls this directly

Calls 3

assertIsNaNMethod · 0.95
subTestMethod · 0.80
fmaMethod · 0.45

Tested by

no test coverage detected