INF, Nan, Zero and IEEE/SANE arithmetic
What's new in Analytica 4.0? >
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.
Enable comment auto-refresher