Example #1
0
 def test_special(self):
     assert_equal(ncu.log1p(np.nan), np.nan)
     assert_equal(ncu.log1p(np.inf), np.inf)
     with np.errstate(divide="ignore"):
         assert_equal(ncu.log1p(-1.), -np.inf)
     with np.errstate(invalid="ignore"):
         assert_equal(ncu.log1p(-2.), np.nan)
         assert_equal(ncu.log1p(-np.inf), np.nan)
Example #2
0
 def test_special(self):
     assert_equal(ncu.log1p(np.nan), np.nan)
     assert_equal(ncu.log1p(np.inf), np.inf)
     with np.errstate(divide="ignore"):
         assert_equal(ncu.log1p(-1.0), -np.inf)
     with np.errstate(invalid="ignore"):
         assert_equal(ncu.log1p(-2.0), np.nan)
         assert_equal(ncu.log1p(-np.inf), np.nan)
Example #3
0
 def test_log1p(self):
     assert_almost_equal(ncu.log1p(0.2), ncu.log(1.2))
     assert_almost_equal(ncu.log1p(1e-6), ncu.log(1 + 1e-6))
 def test_log1p(self):
     assert_almost_equal(ncu.log1p(0.2), ncu.log(1.2))
     assert_almost_equal(ncu.log1p(1e-6), ncu.log(1 + 1e-6))