-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
Description
Reported from JuliaIntervals/IntervalRootFinding.jl#225
Currently, we are not supporting irrational numbers defined in IrraitonalConstants.jl
julia> using IntervalArithmetic, IrrationalConstants
julia> interval(twoπ)
ERROR: ArgumentError: only irrationals from MathConstants are supported
It would be relatively straightforward to support it, by defining our own interval rounding for all of their constants, just like we do for the golden ratio
IntervalArithmetic.jl/src/intervals/construction.jl
Lines 101 to 104 in 544c000
_round(::Type{T}, ::Irrational{:φ}, r::RoundingMode{:Down}) where {T<:NumTypes} = | |
__round(T, inf((bareinterval(BigFloat, 1) + sqrt(bareinterval(BigFloat, 5))) / bareinterval(BigFloat, 2)), r) | |
_round(::Type{T}, ::Irrational{:φ}, r::RoundingMode{:Up}) where {T<:NumTypes} = | |
__round(T, sup((bareinterval(BigFloat, 1) + sqrt(bareinterval(BigFloat, 5))) / bareinterval(BigFloat, 2)), r) |