@@ -1404,6 +1404,36 @@ def test_log_strides(self):
1404
1404
assert_array_almost_equal_nulp (np .log (x_f64 [::jj ]), y_true [::jj ], nulp = 2 )
1405
1405
assert_array_almost_equal_nulp (np .log (x_special [::jj ]), y_special [::jj ], nulp = 2 )
1406
1406
1407
+ # Reference values were computed with mpmath, with mp.dps = 200.
1408
+ @pytest .mark .parametrize (
1409
+ 'z, wref' ,
1410
+ [(1 + 1e-12j , 5e-25 + 1e-12j ),
1411
+ (1.000000000000001 + 3e-08j ,
1412
+ 1.5602230246251546e-15 + 2.999999999999996e-08j ),
1413
+ (0.9999995000000417 + 0.0009999998333333417j ,
1414
+ 7.831475869017683e-18 + 0.001j ),
1415
+ (0.9999999999999996 + 2.999999999999999e-08j ,
1416
+ 5.9107901499372034e-18 + 3e-08j ),
1417
+ (0.99995000042 - 0.009999833j ,
1418
+ - 7.015159763822903e-15 - 0.009999999665816696j )],
1419
+ )
1420
+ def test_log_precision_float64 (self , z , wref ):
1421
+ w = np .log (z )
1422
+ assert_allclose (w , wref , rtol = 1e-15 )
1423
+
1424
+ # Reference values were computed with mpmath, with mp.dps = 200.
1425
+ @pytest .mark .parametrize (
1426
+ 'z, wref' ,
1427
+ [(np .complex64 (1.0 + 3e-6j ), np .complex64 (4.5e-12 + 3e-06j )),
1428
+ (np .complex64 (1.0 - 2e-5j ), np .complex64 (1.9999999e-10 - 2e-5j )),
1429
+ (np .complex64 (0.9999999 + 1e-06j ),
1430
+ np .complex64 (- 1.192088e-07 + 1.0000001e-06j ))],
1431
+ )
1432
+ def test_log_precision_float32 (self , z , wref ):
1433
+ w = np .log (z )
1434
+ assert_allclose (w , wref , rtol = 1e-6 )
1435
+
1436
+
1407
1437
class TestExp :
1408
1438
def test_exp_values (self ):
1409
1439
x = [1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 ]
0 commit comments