Skip to content

Commit

Permalink
Add more subnormals and test log2 and log10
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Feb 7, 2021
1 parent fbbabdd commit b51f4cc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,13 @@ end
end
@testset "log of subnormals" begin
# checked results with WolframAlpha
for (T, ex, res) in ((Float32, -128, -88.72284f0),
(Float64, -1024, -709.782712893384))
@test log(T(2)^ex) res
for (T, lr) in ((Float32, LinRange(2.f0^(-129), 2.f0^(-128), 1000)),
(Float64, LinRange(2.0^(-1025), 2.0^(-1024), 1000)))
for x in lr
@test log(x) T(log(widen(x))) rtol=2eps(T)
@test log2(x) T(log2(widen(x))) rtol=2eps(T)
@test log10(x) T(log10(widen(x))) rtol=2eps(T)
end
end
end
end
Expand Down

0 comments on commit b51f4cc

Please sign in to comment.