Skip to content

Commit

Permalink
Remove the non-existing rounding mode ArbRoundExact
Browse files Browse the repository at this point in the history
It doesn't actually exist in Flint, and was probably a misread of
ARF_PREC_EXACT.
  • Loading branch information
Joel-Dahne committed Feb 23, 2024
1 parent 5a8e08b commit 7f7bf62
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/rounding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ ARF_RND_UP (1)
ArbRoundDown, # ARF_RND_FLOOR
ArbRoundUp, # ARF_RND_CEIL
ArbRoundNearest, # ARF_RND_NEAR
ArbRoundExact # ARF_PREC_EXACT
)

Base.convert(::Type{arb_rnd}, ::RoundingMode{:ToZero}) = ArbRoundToZero
Base.convert(::Type{arb_rnd}, ::RoundingMode{:FromZero}) = ArbRoundFromZero
Base.convert(::Type{arb_rnd}, ::RoundingMode{:Down}) = ArbRoundDown
Base.convert(::Type{arb_rnd}, ::RoundingMode{:Up}) = ArbRoundUp
Base.convert(::Type{arb_rnd}, ::RoundingMode{:Nearest}) = ArbRoundNearest
Base.convert(::Type{arb_rnd}, ::RoundingMode{:Exact}) = ArbRoundExact

function Base.convert(::Type{RoundingMode}, r::arb_rnd)
if r == ArbRoundToZero
Expand All @@ -40,8 +38,6 @@ function Base.convert(::Type{RoundingMode}, r::arb_rnd)
return RoundUp
elseif r == ArbRoundNearest
return RoundNearest
elseif r == ArbRoundExact
return RoundingMode{:Exact}()
else
throw(ArgumentError("invalid Arb rounding mode code: $r"))
end
Expand Down
2 changes: 0 additions & 2 deletions test/rounding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
@test convert(Arblib.arb_rnd, RoundDown) == Arblib.ArbRoundDown
@test convert(Arblib.arb_rnd, RoundUp) == Arblib.ArbRoundUp
@test convert(Arblib.arb_rnd, RoundNearest) == Arblib.ArbRoundNearest
@test convert(Arblib.arb_rnd, RoundingMode{:Exact}()) == Arblib.ArbRoundExact

@test convert(RoundingMode, Arblib.ArbRoundToZero) == RoundToZero
@test convert(RoundingMode, Arblib.ArbRoundFromZero) == RoundFromZero
@test convert(RoundingMode, Arblib.ArbRoundDown) == RoundDown
@test convert(RoundingMode, Arblib.ArbRoundUp) == RoundUp
@test convert(RoundingMode, Arblib.ArbRoundNearest) == RoundNearest
@test convert(RoundingMode, Arblib.ArbRoundExact) == RoundingMode{:Exact}()
end

0 comments on commit 7f7bf62

Please sign in to comment.