@@ -106,27 +106,41 @@ end
106
106
@test_approx_eq erfi (1 + 2im ) - 0.011259006028815025076 + 1.0036063427256517509im
107
107
@test_approx_eq dawson (1 + 2im ) - 13.388927316482919244 - 11.828715103889593303im
108
108
109
- for x in logspace (- 200 , - 0.01 )
110
- @test_approx_eq_eps erf (erfinv (x)) x 1e-12 * x
111
- @test_approx_eq_eps erf (erfinv (- x)) - x 1e-12 * x
112
- @test_approx_eq_eps erfc (erfcinv (2 * x)) 2 * x 1e-12 * x
113
- if x > 1e-20
114
- xf = Float32 (x)
115
- @test_approx_eq_eps erf (erfinv (xf)) xf 1e-5 * xf
116
- @test_approx_eq_eps erf (erfinv (- xf)) - xf 1e-5 * xf
117
- @test_approx_eq_eps erfc (erfcinv (2 xf)) 2 xf 1e-5 * xf
109
+ for elty in [Float32,Float64]
110
+ for x in logspace (- 200 , - 0.01 )
111
+ @test_approx_eq_eps erf (erfinv (x)) x 1e-12 * x
112
+ @test_approx_eq_eps erf (erfinv (- x)) - x 1e-12 * x
113
+ @test_approx_eq_eps erfc (erfcinv (2 * x)) 2 * x 1e-12 * x
114
+ if x > 1e-20
115
+ xf = Float32 (x)
116
+ @test_approx_eq_eps erf (erfinv (xf)) xf 1e-5 * xf
117
+ @test_approx_eq_eps erf (erfinv (- xf)) - xf 1e-5 * xf
118
+ @test_approx_eq_eps erfc (erfcinv (2 xf)) 2 xf 1e-5 * xf
119
+ end
118
120
end
121
+ @test erfinv (one (elty)) == Inf
122
+ @test erfinv (- one (elty)) == - Inf
123
+ @test_throws DomainError erfinv (2.0 * one (elty))
124
+
125
+ @test erfcinv (zero (elty)) == Inf
126
+ @test_throws DomainError erfcinv (- one (elty))
119
127
end
120
128
129
+ @test erfinv (one (Int)) == erfinv (1.0 )
130
+ @test erfcinv (one (Int)) == erfcinv (1.0 )
131
+
121
132
# airy
122
133
@test_approx_eq airy (1.8 ) 0.0470362168668458052247
134
+ @test_approx_eq airy (1.8 ) airyai (1.8 )
123
135
@test_approx_eq airyprime (1.8 ) - 0.0685247801186109345638
136
+ @test_approx_eq airyaiprime (1.8 ) airyprime (1.8 )
124
137
@test_approx_eq airybi (1.8 ) 2.595869356743906290060
125
138
@test_approx_eq airybiprime (1.8 ) 2.98554005084659907283
126
139
@test_throws Base. Math. AmosException airy (200im )
127
140
@test_throws Base. Math. AmosException airybi (200 )
128
141
@test_throws ArgumentError airy (5 ,one (Complex128))
129
142
z = 1.8 + 1.0im
143
+ @test_approx_eq airyx (z) airyx (0 ,z)
130
144
@test_approx_eq airyx (0 , z) airy (0 , z) * exp (2 / 3 * z * sqrt (z))
131
145
@test_approx_eq airyx (1 , z) airy (1 , z) * exp (2 / 3 * z * sqrt (z))
132
146
@test_approx_eq airyx (2 , z) airy (2 , z) * exp (- abs (real (2 / 3 * z * sqrt (z))))
@@ -218,6 +232,7 @@ y33 = bessely(3,3.)
218
232
@test_throws Base. Math. AmosException bessely (200.5 ,0.1 )
219
233
@test_throws DomainError bessely (0.4 ,- 1.0 )
220
234
@test_throws DomainError bessely (0.4 ,Float32 (- 1.0 ))
235
+ @test_throws DomainError bessely (1 ,Float32 (- 1.0 ))
221
236
222
237
# issue #6653
223
238
for f in (besselj,bessely,besseli,besselk,hankelh1,hankelh2)
@@ -473,6 +488,14 @@ with_bigfloat_precision(10_000) do
473
488
@test log (2 ,big (2 )^ 400 ) == 400
474
489
end
475
490
491
+ for T in (Float32,Float64)
492
+ @test log (zero (T)) == - Inf
493
+ @test isnan (log (NaN ))
494
+ @test_throws DomainError log (- one (T))
495
+ @test log1p (- one (T)) == - Inf
496
+ @test isnan (log1p (NaN ))
497
+ @test_throws DomainError log1p (- 2 * one (T))
498
+ end
476
499
# test vectorization of 2-arg vectorized functions
477
500
binary_math_functions = [
478
501
copysign, flipsign, log, atan2, hypot, max, min,
0 commit comments