06-17-2009 11:08 AM
06-17-2009 11:09 AM
12-18-2017 04:49 PM - edited 12-18-2017 04:52 PM
This is how:
// The equivalent of: // if( isnan( f ) ) {;} // is: if( !( f == f )) {;}
If the variable is not nan the equality operator will always output true when the same variable is compared with itself. But because the result of any comparison operation done with a nan is always false, if that variable is a nan the result will always be false.
12-18-2017 08:04 PM
Artst wrote:// The equivalent of: // if( isnan( f ) ) {;} // is: if( !( f == f )) {;}
Why would you post offtopic text code in a LabVIEW forum? (and in a thread that is 8+ years old!)
@Artst wrote:
... because the result of any comparison operation done with a nan is always false, ....
This statement is incorrect too. Some comparisons with NaN result in a TRUE. Here is one of them.
12-19-2017 01:32 AM
Hi!
There is a discussion about the same problem for MATLAB. As I understand it, acording to IEEE 754 standard +Inf, -Inf and NaN are valid results for math processors. If the "division-by-zero test" is built into LabView software it would slow the performance. So: there is no general solution to check our floating point operations. If necessary we will have to do it on a case-by-case basis.