|
49 | 49 | x = rand() |
50 | 50 | for f in ( |
51 | 51 | foo, inv_foo, log, log2, log10, log1p, sqrt, |
52 | | - 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()), |
| 52 | + Base.Fix2(^, 3*rand() - 0.5), Base.Fix2(^, rand(float.([-10:-1; 1:10]))), Base.Fix1(^, rand()), Base.Fix1(log, rand()), Base.Fix1(log, 1/rand()), Base.Fix2(log, rand()), |
53 | 53 | ) |
54 | 54 | InverseFunctions.test_inverse(f, x) |
55 | 55 | end |
|
92 | 92 | @test_throws DomainError inverse(Base.Fix2(^, 0.51))(complex(-5)) |
93 | 93 | @test_throws DomainError inverse(Base.Fix2(^, 2))(complex(-5)) |
94 | 94 | InverseFunctions.test_inverse(Base.Fix2(^, 0.5), complex(-5)) |
| 95 | + @test_throws DomainError inverse(Base.Fix2(^, 2)) |
| 96 | + @test_throws DomainError inverse(Base.Fix2(^, -4)) |
| 97 | + InverseFunctions.test_inverse(Base.Fix2(^, 2.0), 4) |
| 98 | + @test_throws DomainError inverse(Base.Fix1(^, 2.0))(-4) |
| 99 | + @test_throws DomainError inverse(Base.Fix1(^, -2.0))(4) |
| 100 | + @test_throws DomainError inverse(Base.Fix1(^, 0))(4) |
| 101 | + @test_throws DomainError inverse(Base.Fix1(log, -2))(4) |
| 102 | + @test_throws DomainError inverse(Base.Fix1(log, 1))(4) |
| 103 | + @test_throws DomainError inverse(Base.Fix2(^, 0))(4) |
| 104 | + @test_throws DomainError inverse(Base.Fix2(log, -2))(4) |
| 105 | + @test_throws DomainError inverse(Base.Fix2(log, 1))(4) |
95 | 106 | InverseFunctions.test_inverse(Base.Fix2(^, -1), complex(-5.)) |
96 | 107 | @test_throws DomainError inverse(Base.Fix2(^, 2))(-5) |
97 | 108 | @test_throws DomainError inverse(Base.Fix1(^, 2))(-5) |
@@ -143,11 +154,10 @@ end |
143 | 154 | InverseFunctions.test_inverse(sqrt, x) |
144 | 155 | @test_throws DomainError inverse(sqrt)(-x) |
145 | 156 |
|
146 | | - InverseFunctions.test_inverse(Base.Fix2(^, 2), x) |
147 | | - @test_throws DomainError inverse(Base.Fix2(^, 2))(-x) |
148 | 157 | InverseFunctions.test_inverse(Base.Fix2(^, 3), x) |
149 | 158 | InverseFunctions.test_inverse(Base.Fix2(^, 3), -x) |
150 | 159 | InverseFunctions.test_inverse(Base.Fix2(^, -3.5), x) |
| 160 | + @test_throws DomainError inverse(Base.Fix2(^, 2))(-x) |
151 | 161 | end |
152 | 162 |
|
153 | 163 | @testset "dates" begin |
|
0 commit comments