@@ -52,6 +52,15 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A))
52
52
end
53
53
InverseFunctions. test_inverse (conj, 2 - 3im )
54
54
55
+ x = rand (0 : 10 )
56
+ for f in (Base. Fix2 (divrem, rand ([- 5 : - 1 ; 1 : 5 ])), Base. Fix2 (fldmod, rand ([- 5 : - 1 ; 1 : 5 ])), Base. Fix2 (divrem, 0.123 ), Base. Fix2 (fldmod, 0.123 ))
57
+ compare = (a, b) -> all (isapprox .(a, b))
58
+ InverseFunctions. test_inverse (f, x; compare= compare)
59
+ InverseFunctions. test_inverse (f, - x; compare= compare)
60
+ InverseFunctions. test_inverse (f, x/ 9 ; compare= compare)
61
+ InverseFunctions. test_inverse (f, - x/ 9 ; compare= compare)
62
+ end
63
+
55
64
# ensure that inverses have domains compatible with original functions
56
65
@test_throws DomainError inverse (Base. Fix1 (* , 0 ))
57
66
@test_throws DomainError inverse (Base. Fix2 (^ , 0 ))
@@ -66,6 +75,11 @@ InverseFunctions.inverse(f::Bar) = Bar(inv(f.A))
66
75
@test_throws DomainError inverse (Base. Fix1 (^ , - 2 ))(3 )
67
76
@test_throws DomainError inverse (Base. Fix1 (^ , - 2 ))(3 )
68
77
78
+ @test_throws DomainError inverse (Base. Fix2 (divrem, 5 ))((- 3 , 2 ))
79
+ @test_throws DomainError inverse (Base. Fix2 (fldmod, 5 ))((- 3 , - 2 ))
80
+ InverseFunctions. test_inverse (inverse (Base. Fix2 (divrem, 5 )), (- 3 , - 2 ); compare= (== ))
81
+ InverseFunctions. test_inverse (inverse (Base. Fix2 (fldmod, 5 )), (- 3 , 2 ); compare= (== ))
82
+
69
83
A = rand (5 , 5 )
70
84
for f in (
71
85
identity, inv, adjoint, transpose,
0 commit comments