Skip to content

Commit

Permalink
useradius for epsilon
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff authored Jan 10, 2017
1 parent e66d3fe commit 9ec94be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/basics/IEEEfp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ ulp10(x::Integer) = ulp10(Float64(x))


function eps{T<:ArbFloat}(x::T)
ieps = ulp2(x) # internal_eps(x)
return T(ieps)
return radius(x)
end
eps{P}(x::ArbFloat{P}) = ArbFloat{P}( internal_eps(x) )
eps{P}(x::ArbFloat{P}) = radius(x)
#=
eps{T<:ArbFloat}(::Type{T}) = T(internal_eps(T))
internal_eps{T<:ArbFloat}(::Type{T}) = ldexp(0.5,1-precision(T)) # for intertype workings
Expand All @@ -243,11 +243,12 @@ function internal_eps{P}(x::ArbFloat{P}) # for intratype workings
end
return z
end
=#

function nextfloat{P}(x::ArbFloat{P})
x + ulp2(x)
x + radius(x)
end

function prevfloat{P}(x::ArbFloat{P})
x - ulp2(x)
x - radius(x)
end

0 comments on commit 9ec94be

Please sign in to comment.