FreeMat: INF Infinity Constant

FreeMat

- Main Page
- Related Pages

INF Infinity Constant

Section: Base Constants

# Usage

Returns a value that represents positive infinity for both 32 and 64-bit floating point values. There are several forms for the `Inf` function. The first form returns a double precision `Inf`.

       y = inf

The next form takes a class name that can be either `'double'`

       y = inf('double')

or `'single'`:

       y = inf('single')

With a single parameter it generates a square matrix of `inf`s.

       y = inf(n)

Alternatively, you can specify the dimensions of the array via

       y = inf(m,n,p,...)

or

       y = inf([m,n,p,...])

Finally, you can add a classname of either `'single'` or `'double'`.

# Internals

The infinity constant has several interesting properties. In particular:

Note that infinities are not preserved under type conversion to integer types (see the examples below).

# Example

The following examples demonstrate the various properties of the infinity constant.

    --> inf*0

    ans =
     NaN

    --> inf*2

    ans =
     Inf

    --> inf*-2

    ans =
     -Inf

    --> inf/inf

    ans =
     NaN

    --> inf/0

    ans =
     Inf

    --> inf/nan

    ans =
     NaN

Note that infinities are preserved under type conversion to floating point types (i.e., `float`, `double`, `complex` and `dcomplex` types), but not integer types.

    --> uint32(inf)

    ans =
     4294967295

    --> complex(inf)

    ans =
     Inf