Skip to content

Commit

Permalink
Test for setting/getting rounding for F32 and F64 (#45248)
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt authored May 11, 2022
1 parent 72794c7 commit a734ae4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/rounding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,13 @@ end
@test f.(a, digits=9, base = 2) == map(x->f(x, digits=9, base = 2), a)
end
end

@testset "rounding for F32/F64" begin
for T in [Float32, Float64]
old = rounding(T)
Base.Rounding.setrounding_raw(T, Base.Rounding.JL_FE_TOWARDZERO)
@test rounding(T) == RoundToZero
@test round(T(2.7)) == T(2.0)
Base.Rounding.setrounding_raw(T, Base.Rounding.to_fenv(old))
end
end

0 comments on commit a734ae4

Please sign in to comment.