Closed
Description
Currently comparisons between Float16
and integer types fall back to using promote_type
(instead of specific methods as for other floating point types). The promotion goes to Float16
. This leads to the following sort of errors and inconsistencies:
julia-1.1> Inf16 == typemax(Int)
true
julia-1.1> Inf16 == 10^5
true
Compare:
julia-1.1> Inf16 == 1.0e5 # promotion works for float-float comparisons
false
julia-1.1> Inf32 <= typemax(UInt128)
false
julia-1.1> Float32(typemax(UInt128))
Inf32 # overflow is ok when it doesn't confound comparisons
Verified on a variety of Julia versions from 0.6.4 through a recent nightly.