tags:

views:

366

answers:

1

How do I initialize number with NaN in Borland C++?

duplicate: Using NaN in C++?

+4  A: 

You can look at std::numeric_limits<double>::quiet_NaN(). Include <limits>.

Carl Seleborg
In the documentation they say "The quiet NaN for type int is: 0"... how can I discriminate between NaN and real 0?
luvieere
NaN is only applicable for floating point types.
Bill
@luvieere. Check std::numeric_limits<int>::has_quiet_NaN; You will find it is false. while std::numeric_limits<double>::has_quiet_NaN is true
Martin York