User API
These are functions you can use on any ThickNumber subtype when writing your code. Generally you shouldn't need to implement these directly (they all have default implementations), although you can of course specialize them as needed as long as your implementation does not violate the interface requirements.
Types
ThickNumbers.valuetype — Function
valuetype(::Type{<:ThickNumber})Return the type of the numbers in the span, i.e., the T in ThickNumber{T}.
Examples
julia> valuetype(Interval{Float64})
Float64Query functions
API functions from the Interval Arithmetic Standard (IEEE Std 1788-2015), Table 9.2 are supported. One (deliberate) exception is inf and sup, which are replaced by loval and hival: inf and sup have well-defined mathematical meanings that may not be appropriate for all ThickNumber subtypes (e.g., Gaussian random variables don't have finite lower and upper bounds). If you are creating an interval arithmetic package, of course you can choose to define
inf(x::MyInterval) = loval(x)
sup(x::MyInterval) = hival(x)in order to comply with the standard.
ThickNumbers.mid — Function
mid(x::ThickNumber)The midpoint of the span of x. Required by IEEE Std 1788-2015, Table 9.2.
Default implementation
The default implementation is
mid(x::ThickNumber) = (loval(x) + hival(x))/2ThickNumbers.mag — Function
mag(x::ThickNumber)The maximum absolute value of x. Required by IEEE Std 1788-2015, Table 9.2.
Default implementation
The default implementation is
mag(x::ThickNumber) = max(abs(loval(x)), abs(hival(x)))ThickNumbers.mig — Function
mig(x::ThickNumber)The minimum absolute value of x. Required by IEEE Std 1788-2015, Table 9.2.
Default implementation
The default implementation checks to see if the set contains zero, and if so returns zero. Otherwise, it returns the minimum absolute value of the endpoints:
mig(x::ThickNumber) = zero(T) ∈ x ? zero(T) : min(abs(loval(x)), abs(hival(x)))ThickNumbers.rad — Function
rad(x::ThickNumber)Half the width of the span of x. Required by IEEE Std 1788-2015, Table 9.2.
Default implementation
The default implementation is
rad(x::ThickNumber) = wid(x)/2ThickNumbers.wid — Function
wid(x::ThickNumber)The width of the span of x. Required by IEEE Std 1788-2015, Table 9.2.
Default implementation
The default implementation is
wid(x::ThickNumber) = hival(x) - loval(x)ThickNumbers.isfinite_tn — Function
isfinite_tn(x::ThickNumber)Returns true if all values in x are finite, false otherwise.
ThickNumbers.isinf_tn — Function
isinf_tn(x::ThickNumber)Returns true if any value in x is infinite, false otherwise.
ThickNumbers.isnan_tn — Function
isnan_tn(x::ThickNumber)Returns true if any value in x is NaN, false otherwise.
Comparison operators
ThickNumbers.iseq_tn — Function
iseq_tn(a::ThickNumber, b::ThickNumber)
a ≐ b (`\doteq`-TAB`)Returns true if a and b are both empty or both loval and hival are equal in the sense of ==. It is false otherwise.
ThickNumbers.isequal_tn — Function
isequal_tn(a::ThickNumber, b::ThickNumber)Returns true if a and b are both empty or both loval and hival are equal in the sense of isequal. It is false otherwise.
ThickNumbers.isapprox_tn — Function
isapprox_tn(a::ThickNumber, b::ThickNumber; atol=0, rtol::Real=atol>0 ? 0 : √eps)
a ⩪ b (`\dotsim`-TAB)Returns true if a and b are both empty or both loval and hival are approximately equal (≈). It is false otherwise.
ThickNumbers.isless_tn — Function
isless_tn(a::ThickNumber, b::ThickNumber)Returns true if isless(hival(a), loval(b)), false otherwise. See also ≺.
ThickNumbers.:≺ — Function
a ≺ bReturns true if hival(a) < loval(b), false otherwise. Use \prec-TAB to type.
ThickNumbers.:≻ — Function
a ≻ bReturns true if loval(a) > hival(b), false otherwise. Use \succ-TAB to type.
ThickNumbers.:⪯ — Function
a ≼ bReturns true if hival(a) ≤ loval(b), false otherwise. Use \preceq-TAB to type.
ThickNumbers.:⪰ — Function
a ≽ bReturns true if loval(a) ≥ hival(b), false otherwise. Use \succeq-TAB to type.
Set operations
See also IntervalSets for a more flexible way of supporting intervals as sets.
ThickNumbers.hull — Function
hull(a::ThickNumber, b::ThickNumber, c::ThickNumber...)Construct a ThickNumber containing a, b, and c....
Base.isempty — Method
isempty(x::ThickNumber)Returns true if hival(x) < loval(x) is empty, false otherwise.
ThickNumbers.issubset_tn — Function
issubset_tn(a::ThickNumber, b::ThickNumber)
⫃(a::ThickNumber, b::ThickNumber)Returns true if a is a subset of b, false otherwise.
See documentation for why this is not just ⊆
ThickNumbers.issupset_tn — Function
issupset_tn(a::ThickNumber, b::ThickNumber)
⫄(a::ThickNumber, b::ThickNumber)The converse of issubset_tn.
ThickNumbers.is_strict_subset_tn — Function
is_strict_subset_tn(a::ThickNumber, b::ThickNumber)
⪽(a::ThickNumber, b::ThickNumber)Returns true if a is a strict subset of b, false otherwise. a is a strict subset if a is a subset of b not equal to b.
See documentation for why this is not just ⊂.
ThickNumbers.is_strict_supset_tn — Function
is_strict_supset_tn(a::ThickNumber, b::ThickNumber)
⪾(a::ThickNumber, b::ThickNumber)The converse of is_strict_subset_tn.
Also supported are Base's:
isdisjointintersect
Operations with real numbers
clamp(::Real, ::ThickNumber)