INF, Nan, Zero and IEEE/SANE arithmetic
Analytica 4.0 complies with the IEEE 754 standard (and the related SANE standard) for floating point arithmetic, including in its treatment of infinite values. As specified by IEEE 754, Analytica represents three special values:
INF: Infinity -INF: negative infinity NaN: Not a Number
Analytica follows IEEE 754 and SANE standards in the following:
x * INF → INF for x>0 x * -INF → INF for x<0 INF - INF → NaN x / 0 → INF for x>0 0 * INF → NaN 0 / 0 → NaN x * NaN → NaN
Note: x > 0 means x is not NaN but may be INF.
In this, Analytica 4.0 differs from 3.1 and earlier releases which did not comply with the IEEE 754 standard when multiplying INF or Nan by zero. Analytica 3.1 and earlier gave:
0 * INF → 0 0 * NaN → 0
If you find that your model built with Analytica 3.1 or earlier is now generating NaN, where before it generated numbers, this change could be the reason. Analytica 4.0 will give a warning if it detects such a multiplication of INF or NaN by zero, if you check Show Result Warnings in the Preferences dialog from the Edit menu. on.
You can test whether x is Nan or INF in these ways:
x = INF x = -INF IsNan(x) → True (1) if x = Nan IsNumber(x) → True (1) if x is a number, INF, -INF, or Nan, and False (0) if x is a text, reference, Null, Undefined, or other type.
Raising a negative number to a fractional power, using the x^y operator, can also result in NaN. For example:
(-1)^0.5 → NaN
This example would be the imaginary number i, but since Analytica does not support imaginary and complex numbers, NaN is returned. Analytica 4.1 and earlier always returns NaN when x is negative and y is not an integer. Analytica 4.2 and later will return real-valued results for some combinations of negative x and fractional exponent, see Exponentiation of negative numbers. Note: Analytica returns 0 for 0^0, non NaN (which is appropriate in some contexts and not in others).