Optional API functions
These methods have default implementations, but depending on the characteristics of your ThickNumber subtype you might prefer to supply your own implementation.
Julia Base functions (see Julia's own documentation for details):
Base.typemin(::Type{<:ThickNumber})Base.typemax(::Type{<:ThickNumber})
Exported functions:
ThickNumbers.midrad — Functionmidrad(::Type{TN}, mid, rad) where TN<:ThickNumberConstruct a TN from its midpoint mid and radius rad.
Interface requirements
If
x = midrad(TN, mid, rad)succeeds without throwing an error and rad >= 0, then it is required that
typeof(x) <: TN
rad(x) >= rad && rad(x) ≈ radIf rad < 0, then it is required that
typeof(x) <: TN
isempty(x)ThickNumbers.emptyset — Functionemptyset(::Type{TN}) where TN<:ThickNumber
emptyset(x::ThickNumber)Construct an "empty set" of type TN.
Default implementation
The default implementation creates an empty set by making the loval be bigger than the hival. Specifically, the default implementation is
emptyset(::Type{TN}) where TN<:ThickNumber{T} where T = lohi(TN, typemax(T), typemin(T))Examples
julia> emptyset(Interval{Float64})
Interval{Float64}(Inf, -Inf)