Skip to content

NaI returned for valid interval #715

Closed
@lucaferranti

Description

@lucaferranti
julia> interval(typemin(Int64), typemax(Int64))
┌ Warning: ill-formed interval [a, b] with a = -9223372036854775808, b = 9223372036854775807 and decoration d = com. NaI is returned
└ @ IntervalArithmetic ~/.julia/packages/IntervalArithmetic/7EbAT/src/intervals/construction.jl:413
∅_ill

despite that should be a valid interval. I think this happens because of the definition

is_valid_interval(::Flavor{:set_based}, a::Real, b::Real) = b - a  0

and b - a overflows in this case

julia> typemax(Int64) - typemin(Int64)
-1

I guess the motivation for not writing the check as b >= a was disallowing interval(Inf, Inf), or was there another compelling reason?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions