@@ -7,7 +7,6 @@ using Test
77@test isnan (NaNMath. pow (- 1.5f0 ,2.3f0 ))
88@test isnan (NaNMath. pow (- 1.5 ,2.3f0 ))
99@test isnan (NaNMath. pow (- 1.5f0 ,2.3 ))
10- @test NaNMath. pow (- 1 ,2 ) isa Float64
1110@test NaNMath. pow (- 1.5f0 ,2 ) isa Float32
1211@test NaNMath. pow (- 1.5f0 ,2 // 1 ) isa Float32
1312@test NaNMath. pow (- 1.5f0 ,2.3f0 ) isa Float32
@@ -16,8 +15,22 @@ using Test
1615@test NaNMath. pow (- 1.5 ,2 // 1 ) isa Float64
1716@test NaNMath. pow (- 1.5 ,2.3f0 ) isa Float64
1817@test NaNMath. pow (- 1.5 ,2.3 ) isa Float64
18+ @test NaNMath. pow (- 1 ,2 ) === 1
19+ @test NaNMath. pow (2 ,2 ) === 4
20+ @test NaNMath. pow (1.0 , 1.0 + im) === 1.0 + 0.0im
21+ @test NaNMath. pow (1.0 + im, 1 ) === 1.0 + 1.0im
22+ @test NaNMath. pow (1.0 + im, 1.0 ) === 1.0 + 1.0im
1923@test isnan (NaNMath. sqrt (- 5 ))
2024@test NaNMath. sqrt (5 ) == Base. sqrt (5 )
25+ @test isnan (NaNMath. sqrt (- 3.2f0 )) && NaNMath. sqrt (- 3.2f0 ) isa Float32
26+ @test isnan (NaNMath. sqrt (- BigFloat (7.0 ))) && NaNMath. sqrt (- BigFloat (7.0 )) isa BigFloat
27+ @test isnan (NaNMath. sqrt (- 7 )) && NaNMath. sqrt (- 7 ) isa Float64
28+ @inferred NaNMath. sqrt (5 )
29+ @inferred NaNMath. sqrt (5.0 )
30+ @inferred NaNMath. sqrt (5.0f0 )
31+ @inferred NaNMath. sqrt (- 5 )
32+ @inferred NaNMath. sqrt (- 5.0 )
33+ @inferred NaNMath. sqrt (- 5.0f0 )
2134@test NaNMath. sum ([1. , 2. , NaN ]) == 3.0
2235@test NaNMath. sum ([1. 2. ; NaN 1. ]) == 4.0
2336@test isnan (NaNMath. sum ([NaN , NaN ]))
202215 @test NaNMath. argmax (x) === CartesianIndex (1 , 2 )
203216 @test NaNMath. argmin (exp,x) === - 1.0
204217 @test NaNMath. argmax (exp,x) === 3.0
205- end
218+ end
219+
220+ # Test forwarding
221+ x = 1 + 2im
222+ for f in (:sin , :cos , :tan , :asin , :acos , :acosh , :atanh , :log , :log2 , :log10 ,
223+ :log1p , :sqrt )
224+ @test @eval (NaNMath.$ f)(x) == $ f (x)
225+ end
226+
227+ struct A end
228+ Base. isless (:: A , :: A ) = false
229+ y = A ()
230+ for f in (:max , :min )
231+ @test @eval (NaNMath.$ f)(y, y) == $ f (y, y)
232+ end
233+ @test NaNMath. pow (x, x) == ^ (x, x)
0 commit comments