@@ -1384,6 +1384,36 @@ def test_log_strides(self):
1384
1384
assert_array_almost_equal_nulp (np .log (x_f64 [::jj ]), y_true [::jj ], nulp = 2 )
1385
1385
assert_array_almost_equal_nulp (np .log (x_special [::jj ]), y_special [::jj ], nulp = 2 )
1386
1386
1387
+ # Reference values were computed with mpmath, with mp.dps = 200.
1388
+ @pytest .mark .parametrize (
1389
+ 'z, wref' ,
1390
+ [(1 + 1e-12j , 5e-25 + 1e-12j ),
1391
+ (1.000000000000001 + 3e-08j ,
1392
+ 1.5602230246251546e-15 + 2.999999999999996e-08j ),
1393
+ (0.9999995000000417 + 0.0009999998333333417j ,
1394
+ 7.831475869017683e-18 + 0.001j ),
1395
+ (0.9999999999999996 + 2.999999999999999e-08j ,
1396
+ 5.9107901499372034e-18 + 3e-08j ),
1397
+ (0.99995000042 - 0.009999833j ,
1398
+ - 7.015159763822903e-15 - 0.009999999665816696j )],
1399
+ )
1400
+ def test_log_precision_float64 (self , z , wref ):
1401
+ w = np .log (z )
1402
+ assert_allclose (w , wref , rtol = 1e-15 )
1403
+
1404
+ # Reference values were computed with mpmath, with mp.dps = 200.
1405
+ @pytest .mark .parametrize (
1406
+ 'z, wref' ,
1407
+ [(np .complex64 (1.0 + 3e-6j ), np .complex64 (4.5e-12 + 3e-06j )),
1408
+ (np .complex64 (1.0 - 2e-5j ), np .complex64 (1.9999999e-10 - 2e-5j )),
1409
+ (np .complex64 (0.9999999 + 1e-06j ),
1410
+ np .complex64 (- 1.192088e-07 + 1.0000001e-06j ))],
1411
+ )
1412
+ def test_log_precision_float32 (self , z , wref ):
1413
+ w = np .log (z )
1414
+ assert_allclose (w , wref , rtol = 1e-6 )
1415
+
1416
+
1387
1417
class TestExp :
1388
1418
def test_exp_values (self ):
1389
1419
x = [1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 ]
0 commit comments