verry.interval.FloatInterval#

class verry.interval.FloatInterval(inf=None, sup=None)#

Bases: Interval[float]

Double-precision inf-sup type interval.

Parameters:
  • inf (float | int | str | None, optional) – Infimum of the interval.

  • sup (float | int | str | None, optional) – Supremum of the interval.

Variables:
  • inf (float) – Infimum of the interval.

  • sup (float) – Supremum of the interval.

  • converter (Converter)

  • endtype (type[float])

  • operator (Operator)

endtype#

alias of float

classmethod ensure(value)#

Convert value to an interval and return its copy.

copy()#

Return a shallow copy of the interval.

diam()#

Return an upper bound of the diameter.

Warning

x.diam() might not be finite even if x is bounded.

See also

isbounded

Examples

>>> from verry import FloatInterval
>>> x = FloatInterval(-1, 1)
>>> x.diam()
2.0
>>> y = 1e+308 * x
>>> y.isbounded()
True
>>> y.diam()  # results in a positive infinity due to overflow.
inf
hull(*args)#

Return an interval hull.

interiorcontains(other)#

Return True if the interior of the interval contains other.

isbounded()#

Return True if both inf and sup are finite.

isdisjoint(other)#

Return True if the interval has no elements in common with other.

issubset(other)#

Test whether every element in the interval is in other.

issuperset(other)#

Test whether every element in other is in the interval.

mag()#

Return a magnitude of the interval.

The magnitude of x is defined as max(abs(x.inf), abs(x.sup)).

mid()#

Return an approximation of the midpoint.

x.mid() in x is guaranteed to be True for any x.

mig()#

Return a mignitude of the interval.

The mignitude of x is defined as min(abs(x.inf), abs(x.sup)).

rad()#

Return an upper bound of the radius.

width()#

Alias of diam().