@@ -37,7 +37,7 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A))
37
37
x = rand ()
38
38
for f in (
39
39
foo, inv_foo, log, log2, log10, log1p, sqrt,
40
- Base. Fix2 (^ , rand ()), Base. Fix2 (^ , rand ([- 10 : - 1 ; 1 : 10 ])), Base. Fix1 (^ , rand ()), Base. Fix1 (log, rand ()), Base. Fix2 (log, rand ()),
40
+ Base. Fix2 (^ , rand ()), Base. Fix2 (^ , rand ([- 10 : - 1 ; 1 : 10 ])), Base. Fix1 (^ , rand ()), Base. Fix1 (log, rand ()), Base. Fix1 (log, 1 / rand ()), Base . Fix2 (log, rand ()),
41
41
)
42
42
InverseFunctions. test_inverse (f, x)
43
43
end
@@ -55,10 +55,16 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A))
55
55
# ensure that inverses have domains compatible with original functions
56
56
@test_throws DomainError inverse (Base. Fix1 (* , 0 ))
57
57
@test_throws DomainError inverse (Base. Fix2 (^ , 0 ))
58
+ @test_throws DomainError inverse (Base. Fix1 (log, - 2 ))(5 )
58
59
@test_throws DomainError inverse (Base. Fix1 (log, 2 ))(- 5 )
59
- InverseFunctions. test_inverse (Base. Fix1 (log, 2 ), - 5 + 0im )
60
+ InverseFunctions. test_inverse (inverse ( Base. Fix1 (log, 2 )), complex ( - 5 ) )
60
61
@test_throws DomainError inverse (Base. Fix2 (^ , 0.5 ))(- 5 )
61
- InverseFunctions. test_inverse (Base. Fix2 (^ , 0.5 ), - 5 + 0im )
62
+ @test_throws DomainError inverse (Base. Fix2 (^ , 0.51 ))(complex (- 5 ))
63
+ InverseFunctions. test_inverse (Base. Fix2 (^ , 0.5 ), complex (- 5 ))
64
+ @test_throws DomainError inverse (Base. Fix2 (^ , 2 ))(- 5 )
65
+ @test_throws DomainError inverse (Base. Fix1 (^ , 2 ))(- 5 )
66
+ @test_throws DomainError inverse (Base. Fix1 (^ , - 2 ))(3 )
67
+ @test_throws DomainError inverse (Base. Fix1 (^ , - 2 ))(3 )
62
68
63
69
A = rand (5 , 5 )
64
70
for f in (
0 commit comments