Skip to content

Commit 7a0096d

Browse files
committed
Fix NaNMath.acosh
1 parent 96f9732 commit 7a0096d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "NaNMath"
22
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
33
repo = "https://github.com/JuliaMath/NaNMath.jl.git"
44
authors = ["Miles Lubin"]
5-
version = "1.1.2"
5+
version = "1.1.3"
66

77
[deps]
88
OpenLibm_jll = "05823500-19ac-5b8b-9628-191a04bc5112"

src/NaNMath.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ for f in (:asin, :acos, :atanh)
3434
end
3535
end
3636
function acosh(x::T) where T<:Union{Float16, Float32, Float64}
37-
x < T(1) ? T(NaN) : acosh(x)
37+
x < T(1) ? T(NaN) : Base.acosh(x)
3838
end
3939

4040
for f in (:log, :log2, :log10)

test/runtests.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,15 @@ for f in (:max, :min)
232232
@test @eval (NaNMath.$f)(y, y) == $f(y, y)
233233
end
234234
@test NaNMath.pow(x, x) == ^(x, x)
235+
236+
@testset "acosh" begin
237+
for T in (Float16, Float32, Float64)
238+
y = @inferred(NaNMath.acosh(T(0.5)))
239+
@test y isa T
240+
@test isnan(y)
241+
y = NaNMath.acosh(T(2.1))
242+
@test y isa T
243+
@test !isnan(y)
244+
@test y === acosh(T(2.1))
245+
end
246+
end

0 commit comments

Comments
 (0)