JuliaMath / JuliaMath/DoubleFloats.jl

isapprox is incorrect for tolerances beyond standard precision

Open
#206 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
172
Forks
37
PR merge metrics
No merged PRs in 30d

Description

The following is incorrect:

```julia
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.