LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In a DLL, how do you determine if something is NaN (Not A Number)?

I am writing my own DLL and I need to be able to check to see if a number is NaN. I haven't seen any documentation pretaining to this.

Thanks,
Naveen
0 Kudos
Message 1 of 3
(3,155 Views)
> I am writing my own DLL and I need to be able to check to see if a
> number is NaN. I haven't seen any documentation pretaining to this.
>


NaN is a standard IEEE value. If you have math libraries and headers
included, you should be able to to call isNaN(). A low tech way if you
need a workaround is to compare the value to 0.0. NaN is not less than,
not greater than, and not equal to any other numeric value such as 0.0.
You do need to test this out though since I've seen compilers that
optimize this code improperly.

Greg McKaskle
0 Kudos
Message 2 of 3
(3,155 Views)
I'm developing in M$ VC++ and if you print NaN it is "-1.#QNAN0". If testing for NaN with _isnan() it's true for that value, but is not true for 0.0, which is what I would expect.

Thanks for the help though.

Naveen
0 Kudos
Message 3 of 3
(3,155 Views)