MCPcopy Create free account
hub / github.com/numpy/numpy / test_reciprocal

Method test_reciprocal

numpy/core/tests/test_simd.py:556–569  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

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