Skip to content

Commit 9cd17e1

Browse files
committed
fix formating
1 parent 4ad55a5 commit 9cd17e1

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

src/airy.jl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,20 @@ _airyai(z::ComplexF16) = ComplexF16(_airyai(ComplexF32(z)))
3232

3333
function _airyai(z::ComplexOrReal{T}) where T <: Union{Float32, Float64}
3434
if ~isfinite(z)
35-
isnan(z) && return z
36-
if abs(angle(z)) < 2π/3
35+
if abs(angle(z)) < 2*T(π)/3
3736
return exp(-z)
3837
else
3938
return 1 / z
4039
end
4140
end
4241
x, y = real(z), imag(z)
43-
zabs = abs(z)
44-
4542
airy_large_argument_cutoff(z) && return airyai_large_argument(z)
4643
airyai_power_series_cutoff(x, y) && return airyai_power_series(z)
4744

4845
if x > zero(T)
4946
# use relation to besselk (http://dlmf.nist.gov/9.6.E1)
5047
zz = 2 * z * sqrt(z) / 3
51-
return sqrt(z / 3) * besselk_continued_fraction_shift(one(T)/3, zz) / π
48+
return sqrt(z / 3) * besselk_continued_fraction_shift(one(T)/3, zz) / T(π)
5249
else
5350
# z is close to the negative real axis
5451
# for imag(z) == 0 use reflection to compute in terms of bessel functions of first kind (http://dlmf.nist.gov/9.6.E5)
@@ -77,23 +74,20 @@ _airyaiprime(z::ComplexF16) = ComplexF16(_airyaiprime(ComplexF32(z)))
7774

7875
function _airyaiprime(z::ComplexOrReal{T}) where T <: Union{Float32, Float64}
7976
if ~isfinite(z)
80-
isnan(z) && return z
81-
if abs(angle(z)) < 2π/3
77+
if abs(angle(z)) < 2*T(π)/3
8278
return -exp(-z)
8379
else
8480
return 1 / z
8581
end
8682
end
8783
x, y = real(z), imag(z)
88-
zabs = abs(z)
89-
9084
airy_large_argument_cutoff(z) && return airyaiprime_large_argument(z)
9185
airyai_power_series_cutoff(x, y) && return airyaiprime_power_series(z)
9286

9387
if x > zero(T)
9488
# use relation to besselk (http://dlmf.nist.gov/9.6.E2)
9589
zz = 2 * z * sqrt(z) / 3
96-
return -z * besselk_continued_fraction_shift(T(2)/3, zz) / (π * sqrt(T(3)))
90+
return -z * besselk_continued_fraction_shift(T(2)/3, zz) / (T(π) * sqrt(T(3)))
9791
else
9892
# z is close to the negative real axis
9993
# for imag(z) == 0 use reflection to compute in terms of bessel functions of first kind (http://dlmf.nist.gov/9.6.E5)
@@ -122,18 +116,14 @@ _airybi(z::ComplexF16) = ComplexF16(_airybi(ComplexF32(z)))
122116

123117
function _airybi(z::ComplexOrReal{T}) where T <: Union{Float32, Float64}
124118
if ~isfinite(z)
125-
isnan(z) && return z
126119
if abs(angle(z)) < 2π/3
127120
return exp(z)
128121
else
129122
return 1 / z
130123
end
131124
end
132125
x, y = real(z), imag(z)
133-
zabs = abs(z)
134-
135126
airy_large_argument_cutoff(z) && return airybi_large_argument(z)
136-
137127
airybi_power_series_cutoff(x, y) && return airybi_power_series(z)
138128

139129
if x > zero(T)
@@ -171,18 +161,14 @@ _airybiprime(z::ComplexF16) = ComplexF16(_airybiprime(ComplexF32(z)))
171161

172162
function _airybiprime(z::ComplexOrReal{T}) where T <: Union{Float32, Float64}
173163
if ~isfinite(z)
174-
isnan(z) && return z
175-
if abs(angle(z)) < 2π/3
164+
if abs(angle(z)) < 2*T(π)/3
176165
return exp(z)
177166
else
178167
return -1 / z
179168
end
180169
end
181170
x, y = real(z), imag(z)
182-
zabs = abs(z)
183-
184171
airy_large_argument_cutoff(z) && return airybiprime_large_argument(z)
185-
186172
airybi_power_series_cutoff(x, y) && return airybiprime_power_series(z)
187173

188174
if x > zero(T)

0 commit comments

Comments
 (0)