INF Infinity Constant
Section: Base Constants
UsageReturns a value that represents positive infinity for both 32 and 64-bit floating point values. There are several forms for the
Inffunction. The first form returns a double precision
y = inf
The next form takes a class name that can be either
y = inf('double')
y = inf('single')
With a single parameter it generates a square matrix of
y = inf(n)
Alternatively, you can specify the dimensions of the array via
y = inf(m,n,p,...)
y = inf([m,n,p,...])
Finally, you can add a classname of either
Function InternalsThe infinity constant has several interesting properties. In particular:
Note that infinities are not preserved under type conversion to integer types (see the examples below).
ExampleThe 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.,
dcomplex types), but not integer types.
--> uint32(inf) ans = 4294967295 --> complex(inf) ans = Inf