INF, NAN, and NULL - Exception values

Revision as of 00:12, 5 November 2015 by Bbecane (talk | contribs)


INF, NAN, and Null are system constants that arise in exceptional cases.

Chapter10 5.png

INF (infinity): INF is the result of a numerical calculation whose absolute value is larger than largest number Analytica can represent. This could be an overflow — that is a valid real number greater than 1.797 x10+308:

10^1000 → INF

or it could be a division by zero or other result that is mathematically infinite:

1/0 → INF

INF can be positive or negative:

-1 * 10^1000 → -INF

You can use INF as a value in an expression. You can perform useful, mathematically correct arithmetic with INF, such as:

INF + 10 → INF
INF/0 → INF
10 - INF → -INF
100/0 = INF → True

NAN: NAN is the result of a numerical calculation that is an undetermined or imaginary number, including numerical functions whose parameter is outside their domain:

INF - INF → NAN
0/0 → NAN
INF/INF → NAN
Sqrt(-1) → NAN
ArcSin(2) → NAN

It usually gives a warning if you apply a function to a parameter value outside its range, such as the two examples above — unless you have pressed “Ignore warnings”.

Any arithmetic operation, comparison, or function applied to NAN returns NAN:

0/0 <> NAN → NAN

Analytica’s representation and treatment of NAN is consistent with IEEE Floating point standards. NAN stands for “Not A Number,” which is a bit misleading, since NAN really is a kind of number. You can detect NAN in an expression using the IsNaN() function.

Null: Nullis a result that is ill-defined, usually indicating that there is nothing at the location requested, for example a subscript using a value that does not match a value of the index:

Index I := 1..5
X[I=6] → Null

Other operations and functions that can return Null include Slice(), Subscript(), Subindex(), and MDTable().

You can test for Null using the standard = or <> operators, such as:

X[I=6] = Null → True

or you can use IsUndef(X[I=6]).

See Also

Comments


You are not allowed to post comments.