103
103
# hand, we need isapprox methods to be able to conformance test series rings.
104
104
# On the other hand this is essentially the only sensible thing to do in
105
105
# 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 ;
107
107
atol:: Real = 0 , rtol:: Real = 0 ,
108
- nans:: Bool = false , norm:: Function = abs)
108
+ nans:: Bool = false , norm:: Function = abs) where {T <: NCRingElem }
109
109
if is_exact_type (typeof (x)) && is_exact_type (typeof (y))
110
110
@req is_zero (atol) " non-zero atol not supported"
111
111
@req is_zero (rtol) " non-zero rtol not supported"
@@ -114,6 +114,21 @@ function Base.isapprox(x::NCRingElem, y::NCRingElem;
114
114
throw (NotImplementedError (:isapprox , x, y))
115
115
end
116
116
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... )
126
+ = isapprox (x, parent (x)(y); kwarg... )
127
+
128
+ Base. isapprox (x:: Union{Integer, Rational, AbstractFloat} , y:: NCRingElem ; kwarg... )
129
+ = isapprox (parent (y)(x), y; kwarg... )
130
+
131
+
117
132
function divexact_left (x:: NCRingElem , y:: NCRingElem ; check:: Bool = true )
118
133
return divexact_left (promote (x, y)... )
119
134
end
0 commit comments