Skip to content

isapprox is incorrect for tolerances beyond standard precision #206

@tobydriscoll

Description

@tobydriscoll

The following is incorrect:

julia> T = Double64
Double64 (alias for DoubleFloat{Float64})

julia> x = Double64(0.9, 1e-20)
9.00000000000000022214460492503130852e-01

julia> abs(x - T(9)/10)
2.22144604925031320405193304841894479e-17

julia> isapprox(x, T(9)/10; rtol=1e-22, atol=1e-22)
true

If I understand the internals, the isapprox function uses HI(x)===HI(y) as a shortcut for the test, which doesn't look right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions