Closed johnnychen94 closed 5 years ago
Comparing anything to all-zeros with ≈
is fraught, because the default is atol=0
and rtol
yields 0 when the rhs is all-zeros:
help?> ≈
"≈" can be typed by \approx<tab>
search: ≈
isapprox(x, y; rtol::Real=atol>0 ? 0 : √eps, atol::Real=0, nans::Bool=false, norm::Function)
Inexact equality comparison: true if norm(x-y) <= max(atol, rtol*max(norm(x), norm(y))). The default atol is zero and the default rtol depends on the types of x and y.
The keyword argument nans determines whether or not NaN values are considered equal (defaults to false).
...
You can use
julia> @test imfilter(x,reflect(∇x),"circular") ≈ zeros(5,5) atol=1e-12
Test Passed
oh, good to know. thanks