Skip to content

Commit

Permalink
handle near 0 in isapprox
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff authored Jul 14, 2019
1 parent 407af51 commit 6656044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/extras/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Base.isapprox(x::T, y::DoubleFloat{T}; atol::Real=0.0, rtol::Real=atol>
return isapprox(DoubleFloat{T}(x), y, atol=atol, rtol=rtol, nans=nans, norm=norm)
end
function Base.isapprox(x::DoubleFloat{T}, y::DoubleFloat{T}; atol::Real=0.0, rtol::Real=atol>0 ? 0 : eps(DoubleFloat{T})^(37/64), nans::Bool=false, norm::Function=norm) where {T<:IEEEFloat}
x == y || (isfinite(x) && isfinite(y) && abs(x-y) <= max(max(1.0e-38, atol), rtol*max(abs(x), abs(y)))) || (nans && isnan(x) && isnan(y))
x == y || (isfinite(x) && isfinite(y) && abs(x-y) <= max(max(1.0e-32, atol), rtol*max(abs(x), abs(y)))) || (nans && isnan(x) && isnan(y))
end

Base.isapprox(x::DoubleFloat{T}, y::F; atol::Real=0.0, rtol::Real=atol>0.0 ? 0.0 : eps(max(abs(x), abs(y)))^(37/64), nans::Bool=false, norm::Function=norm) where {T<:IEEEFloat, F<:Real} =
Expand Down

2 comments on commit 6656044

@JeffreySarnoff
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/2000

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.2 -m "<description of version>" 665604470ca119f4628e13cd887c7783d02c5725
git push origin v0.9.2

Please sign in to comment.