Skip to content

Commit 58ba507

Browse files
authored
Merge pull request #190 from jkozdon/isapprox
Unify isapprox with Base.isapprox
2 parents 8e19805 + 31421b5 commit 58ba507

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mapreduce.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ end
186186
Same as Base.isapprox, but without keyword args and without nans
187187
"""
188188
function fast_isapprox(x::Number, y::Number, rtol::Real = Base.rtoldefault(x, y), atol::Real=0)
189-
x == y || (isfinite(x) && isfinite(y) && abs(x - y) <= atol + rtol*max(abs(x), abs(y)))
189+
x == y || (isfinite(x) && isfinite(y) && abs(x-y) <= max(atol, rtol*max(abs(x), abs(y))))
190190
end
191191

192192
Base.isapprox(A::GPUArray{T1}, B::GPUArray{T2}, rtol::Real = Base.rtoldefault(T1, T2, 0), atol::Real=0) where {T1, T2} = all(fast_isapprox.(A, B, T1(rtol)|>real, T1(atol)|>real))

0 commit comments

Comments
 (0)