Skip to content

Commit

Permalink
Provide a default isapprox method for ring elements
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 7, 2024
1 parent c6f2611 commit 18c1988
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ function isequal(a::RingElem, b::RingElem)
return parent(a) == parent(b) && a == b
end

# Implement `isapprox` for ring elements via equality by default. On the one
# hand, we need isapprox methods to be able to conformance test series rings.
# On the other hand this is essentially the only sensible thing to do in
# positive characteristic so we might as well do it in a generic method.
function Base.isapprox(x::NCRingElem, y::NCRingElem;

Check warning on line 15 in src/Rings.jl

View check run for this annotation

Codecov / codecov/patch

src/Rings.jl#L15

Added line #L15 was not covered by tests
atol::Real=0, rtol::Real=0,
nans::Bool=false, norm::Function=abs)
return x == y

Check warning on line 18 in src/Rings.jl

View check run for this annotation

Codecov / codecov/patch

src/Rings.jl#L18

Added line #L18 was not covered by tests
end

"""
divexact(x, y; check::Bool=true)
Expand Down

0 comments on commit 18c1988

Please sign in to comment.