103103# hand, we need isapprox methods to be able to conformance test series rings.
104104# On the other hand this is essentially the only sensible thing to do in
105105# positive characteristic so we might as well do it in a generic method.
106- function Base. isapprox (x:: NCRingElem , y:: NCRingElem ;
106+ function Base. isapprox (x:: T , y:: T ;
107107 atol:: Real = 0 , rtol:: Real = 0 ,
108- nans:: Bool = false , norm:: Function = abs)
108+ nans:: Bool = false , norm:: Function = abs) where {T <: NCRingElem }
109109 if is_exact_type (typeof (x)) && is_exact_type (typeof (y))
110110 @req is_zero (atol) " non-zero atol not supported"
111111 @req is_zero (rtol) " non-zero rtol not supported"
@@ -114,6 +114,19 @@ function Base.isapprox(x::NCRingElem, y::NCRingElem;
114114 throw (NotImplementedError (:isapprox , x, y))
115115end
116116
117+ function Base. isapprox (x:: NCRingElem , y:: NCRingElem ; kwarg... )
118+ fl, u, v = try_promote (x, y)
119+ if fl
120+ return isapprox (u, v; kwarg... )
121+ end
122+ throw (NotImplementedError (:isapprox , x, y))
123+ end
124+
125+ Base. isapprox (x:: NCRingElem , y:: Union{Integer, Rational, AbstractFloat} ; kwarg... ) = isapprox (x, parent (x)(y); kwarg... )
126+
127+ Base. isapprox (x:: Union{Integer, Rational, AbstractFloat} , y:: NCRingElem ; kwarg... ) = isapprox (parent (y)(x), y; kwarg... )
128+
129+
117130function divexact_left (x:: NCRingElem , y:: NCRingElem ; check:: Bool = true )
118131 return divexact_left (promote (x, y)... )
119132end
0 commit comments