Why do these two statements give me different results? The first is false
, the second is true
.
0.0 ≈ 1.071327271687239e-17
1.0 ≈ 1.0 + 1.071327271687239e-17
Why do these two statements give me different results? The first is false
, the second is true
.
0.0 ≈ 1.071327271687239e-17
1.0 ≈ 1.0 + 1.071327271687239e-17
The documentation might be helpful. Or the implementation:
julia> @less 0 ≈ 1.071327271687239e-17
function isapprox(x::Number, y::Number; atol::Real=0, rtol::Real=rtoldefault(x,y,atol), nans::Bool=false)
x == y || (isfinite(x) && isfinite(y) && abs(x-y) <= max(atol, rtol*max(abs(x), abs(y)))) || (nans && isnan(x) && isnan(y))
end
Also note that:
julia> 1.0 + 1.071327271687239e-17
1.0