INF, NAN, and Null

Revision as of 06:17, 25 April 2007 by ReneeB (talk | contribs) (adding doc status category)


These are special values that Analytica returns in special conditions:

Inf means infinity or a real number larger than can be

represented -- e.g., 1/0 or 1.797E307 * 10 (because it can't represent numbers larger than 1.796E308)

-Inf rmeans negative infinity or a number smaller than can be

represented, e.g., -1/0

NAN means "Not A Number", where the result is numeric, but not a real number or infinity -- e.g., Sqrt(-1) or 0/0
Null means that there is no such item. Slice, Subscript, SubIndex, or MdTable return Null, for example, when trying to Slice out the nth slice over an Index with less than n values.
Undefined means that a value has never been defined or is uncomputed -- for example, the value of an optional parameter not provided to a function.

Computations with special values

Analytica follows ANSI (Association of National Standards Institutes) standards for computing with these special values, where applicable.

1/Inf → 0
1/(-Inf) → 0
Inf + Inf → Inf
Inf - Inf → NAN

When NULL appears in scalar operations, it generally produces a warning and evaluates to NULL, for example:

10 + NULL → NULL
NULL - 10 → NULL
1 AND NULL → NULL

When NULL appears in an array operation, the result should be ignored; however, at present this treatment of NULL is NOT supported by Analytica, and is subject to change toward this standard in the future. When this semantics is fully incorporated, these examples will apply (assume A is indexed by I as indicated.

I: 1 2 3 4 5
A: 8 NULL 4 NULL 0
Sum(A,I) → 12
Average(A,I) → 4
Join(A,I,',') → "8,4,0"
Comments


You are not allowed to post comments.