Occasionally it is convenient to work with infinite quantities (for example, when working with valuations or cardinalities). Magma provides two such objects, the positive and negative infinities. This section describes the Magma facilities for dealing with such objects.
The infinities are compatible with certain finite quantities: integers, rationals and real numbers. In contexts where a common universe is needed to contain both finite and infinite quantities (for example, if creating a sequence of valuations) the extended reals (type ExtRe) are used. The extended reals are a coproduct-like object that can contain both infinities and compatible finite objects. When viewed as members of the extended reals, the elements are of type ExtReElt.
Certain system intrinsics such as Valuation which normally return an integer may return an infinite object for appropriate exceptional cases. Two special intrinsics are also provided to create infinite objects.
The positive infinity object.
The negative infinity object.
Only basic arithmetic operations are provided for infinite objects. The operations described below may freely mix infinite and finite quantities, but note that certain forms (such as ∞ - ∞ or ∞ * 0) are not well defined and will cause an error.
Infinite objects may be compared with themselves and finite quantities.
Returns 1 if x is the positive infinite object, -1 if x is the negative infinite object.
Returns the positive infinite object.
Returns the infinite object x again; these functions are for convenience when dealing with objects which could be either finite numeric types or infinite objects.
Returns true if x is finite, otherwise false. This is more convenient than checking the type of x.