MCPcopy Index your code
hub / github.com/numpy/numpy / test_reciprocal

Method test_reciprocal

numpy/_core/tests/test_simd.py:563–576  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

561 assert simd == pytest.approx(data, nan_ok=True)
562
563 def test_reciprocal(self):
564 pinf, ninf, nan = self._pinfinity(), self._ninfinity(), self._nan()
565 data = self._data()
566 vdata = self.load(self._data())
567
568 recip_cases = ((nan, nan), (pinf, 0.0), (ninf, -0.0), (0.0, pinf), (-0.0, ninf))
569 for case, desired in recip_cases:
570 data_recip = [desired] * self.nlanes
571 recip = self.recip(self.setall(case))
572 assert recip == pytest.approx(data_recip, nan_ok=True)
573
574 data_recip = self.load([1 / x for x in data]) # load to truncate precision
575 recip = self.recip(vdata)
576 assert recip == data_recip
577
578 def test_special_cases(self):
579 """

Callers

nothing calls this directly

Calls 4

_pinfinityMethod · 0.80
_ninfinityMethod · 0.80
_nanMethod · 0.80
_dataMethod · 0.45

Tested by

no test coverage detected