Approx test of two real numbers


I find it confusing that this passes the test

julia> @test 1.0+1e-10 ≈ 1.0 atol=1e-15
Test Passed

because rtol is set to sqrt(eps), whereas for the correct test I need to write the “ugly” version (manual wording)

julia> @test ≈(1.0+1e-10, 1.0, atol=1e-15, rtol=0.0)
Test Failed
  Expression: ≈(1.0 + 1.0e-10, 1.0, atol=1.0e-15, rtol=0.0)
ERROR: There was an error during testing

Is there a way of adding the rtol parameter to the nice syntax version?


I think you want @test 1.0+1e-10 ≈ 1.0 atol=1e-15 rtol=0?

In 0.7, setting atol>0 will make rtol default to 0 (


Ah, I wanted to add this to the manual, but the master version is completely different…