Does anyone know how to check if a double variable has 1.#INF, -1.#INF, 1.#IND?
Does anyone know how to check if a double variable has 1.#INF, -1.#INF, 1.#IND?
http://www.daemon-systems.org/man/isnan.3.html
Not entirely portable as far as I can tell.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Apparently VC++ has _isnan if you're using that compiler: http://www.parashift.com/c++-faq-lit...html#faq-29.15
You can also compare against infinity:Although I don't know any caveats or details about this.Code:if (std::numeric_limits<double>::has_infinity && d == std::numeric_limits<double>::infinity()) std::cout << "Infinity!\n";
Thanks Salem....... I will look into it.
Thanks Daved....... I will look into it.
I believe one of the boost guys was working on a portable is_nan library. if you search the boost dev mailing list you should be able to find something on it.
"I saw a sign that said 'Drink Canada Dry', so I started"
-- Brendan Behan
Free Compiler: Visual C++ 2005 Express
If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?