NaN: Difference between revisions
AndersBjork (talk | contribs) mNo edit summary |
m Add categories |
||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
'''NaN''' is the notation in LabVIEW for the floating-point value ''Not-a-Number''. LabVIEW implements the [http://grouper.ieee.org/groups/754/ IEEE-754 standard] for floating-point calculations, which specifies unique values for the outputs of mathematical operations which have no meaningful numerical result. A few examples of calculations which produce NaN are: | '''NaN''' is the notation in LabVIEW for the floating-point value ''Not-a-Number''. LabVIEW implements the [http://grouper.ieee.org/groups/754/ IEEE-754 standard] for floating-point calculations, which specifies unique values for the outputs of mathematical operations which have no meaningful numerical result. A few examples of calculations which produce NaN are: | ||
*division of zero by zero | *division of zero by zero | ||
*square root of a negative number | *square root of a negative number | ||
*division of an infinity by an infinity | *division of an infinity by an infinity | ||
*logarithm (any base) of a non-positive number | *logarithm (any base) of a non-positive number | ||
*any calculation which includes NaN as one of its operands | *any calculation which includes NaN as one of its operands | ||
The last example above implies that any calculation sequence which generates NaN as an intermediate step will propagate NaN through all subsequent calculations. While this is generally true, there are exceptions (the LabVIEW '''Power of X''' primitive returns one for zero raised to NaN). | The last example above implies that any calculation sequence which generates NaN as an intermediate step will propagate NaN through all subsequent calculations. While this is generally true, there are exceptions (the LabVIEW '''Power of X''' primitive returns one for zero raised to NaN). | ||
One salient feature of the NaN value is that all comparison operations involving NaN return '''FALSE''', including the equality operator (in other words, NaN != NaN). LabVIEW provides the '''Not A Number/Path/Refnum?''' primitive, which is the proper way to test for NaN. | |||
<center> | <center> | ||
{| class="wikitable FCK__ShowTableBorders" align="center" | {| class="wikitable FCK__ShowTableBorders" align="center" | ||
| Line 21: | Line 18: | ||
|} | |} | ||
</center> | </center> | ||
Floating-point controls, indicators, and block diagram constants support the direct entry of NaN (case-insensitive). Similarly, string-to-numeric and numeric-to-string primitives convert or format NaN without regard to format specifiers. | Floating-point controls, indicators, and block diagram constants support the direct entry of NaN (case-insensitive). Similarly, string-to-numeric and numeric-to-string primitives convert or format NaN without regard to format specifiers. | ||
== Use Cases == | |||
*indicating "missing" data in data-tables in files. | |||
*used for lifting the "plotting pen" in graph, for instance if a value would be out of its allowed range. | |||
== External links == | == External links == | ||
*[http:// | *IEEE pages: | ||
*[http://en.wikipedia.org/wiki/NaN Wikipedia entry on NaN] | **[http://ieeexplore.ieee.org/servlet/opac?punumber=2355 754-1985 - IEEE Standard for Binary Floating-Point Arithmetic] | ||
**[http://ieeexplore.ieee.org/servlet/opac?punumber=4610933 754-2008 - IEEE Standard for Floating-Point Arithmetic] | |||
*Wikipedia entries: | |||
**[http://en.wikipedia.org/wiki/NaN Wikipedia entry on NaN] | |||
**[http://en.wikipedia.org/wiki/IEEE_754 Wikipedia entry on IEEE 754] | |||
[[Category:Numeric]] | |||
[[Category:Constants]] | |||
Latest revision as of 17:36, 6 August 2024
NaN is the notation in LabVIEW for the floating-point value Not-a-Number. LabVIEW implements the IEEE-754 standard for floating-point calculations, which specifies unique values for the outputs of mathematical operations which have no meaningful numerical result. A few examples of calculations which produce NaN are:
- division of zero by zero
- square root of a negative number
- division of an infinity by an infinity
- logarithm (any base) of a non-positive number
- any calculation which includes NaN as one of its operands
The last example above implies that any calculation sequence which generates NaN as an intermediate step will propagate NaN through all subsequent calculations. While this is generally true, there are exceptions (the LabVIEW Power of X primitive returns one for zero raised to NaN).
One salient feature of the NaN value is that all comparison operations involving NaN return FALSE, including the equality operator (in other words, NaN != NaN). LabVIEW provides the Not A Number/Path/Refnum? primitive, which is the proper way to test for NaN.
| Not A Number/Path/Refnum? primitive |
|---|
Floating-point controls, indicators, and block diagram constants support the direct entry of NaN (case-insensitive). Similarly, string-to-numeric and numeric-to-string primitives convert or format NaN without regard to format specifiers.
Use Cases
- indicating "missing" data in data-tables in files.
- used for lifting the "plotting pen" in graph, for instance if a value would be out of its allowed range.
