Iβm trying to understand what lower bounds are for types. I ran the following code which shows which subtypes (recursively) of number satisfies/rejects Int <: T <: Real
in hope of gaining an understanding, however Iβm still lost.
Number
ββ Complex
ββ Real
ββ AbstractFloat
β ββ BigFloat
β ββ Float16
β ββ Float32
β ββ Float64
ββ AbstractIrrational
β ββ Irrational
ββ FixedPoint
β ββ Fixed
β ββ Normed
ββ Integer
β ββ Bool
β ββ Signed
β β ββ BigInt
β β ββ Int128
β β ββ Int16
β β ββ Int32
β β ββ Int64
β β ββ Int8
β ββ Unsigned
β ββ UInt128
β ββ UInt16
β ββ UInt32
β ββ UInt64
β ββ UInt8
ββ Rational
ββ TestStat
function stype(input)
arr = []
append!(arr,subtypes(input))
for x in arr
z = subtypes(x)
if (z != Type[])
append!(arr,z)
end
end
arr
end
for T in stype(Number)
@show T, Int <: T <: Real
end
(T, Int <: T <: Real) = (Complex, false)
(T, Int <: T <: Real) = (Real, true)
(T, Int <: T <: Real) = (AbstractFloat, false)
(T, Int <: T <: Real) = (AbstractIrrational, false)
(T, Int <: T <: Real) = (FixedPointNumbers.FixedPoint, false)
(T, Int <: T <: Real) = (Integer, true)
(T, Int <: T <: Real) = (Rational, false)
(T, Int <: T <: Real) = (StatsBase.TestStat, false)
(T, Int <: T <: Real) = (BigFloat, false)
(T, Int <: T <: Real) = (Float16, false)
(T, Int <: T <: Real) = (Float32, false)
(T, Int <: T <: Real) = (Float64, false)
(T, Int <: T <: Real) = (Irrational, false)
(T, Int <: T <: Real) = (FixedPointNumbers.Fixed, false)
(T, Int <: T <: Real) = (FixedPointNumbers.Normed, false)
(T, Int <: T <: Real) = (Bool, false)
(T, Int <: T <: Real) = (Signed, true)
(T, Int <: T <: Real) = (Unsigned, false)
(T, Int <: T <: Real) = (BigInt, false)
(T, Int <: T <: Real) = (Int128, false)
(T, Int <: T <: Real) = (Int16, false)
(T, Int <: T <: Real) = (Int32, false)
(T, Int <: T <: Real) = (Int64, true)
(T, Int <: T <: Real) = (Int8, false)
(T, Int <: T <: Real) = (UInt128, false)
(T, Int <: T <: Real) = (UInt16, false)
(T, Int <: T <: Real) = (UInt32, false)
(T, Int <: T <: Real) = (UInt64, false)
(T, Int <: T <: Real) = (UInt8, false)
I donβt understand why Int <: T <: Real
is only true for Real, Integer, Signed and Int64