Advertisement

The way to check float/double for NaN

Started by October 02, 2024 04:48 AM
3 comments, last by WitchLord 2 months, 3 weeks ago

Is there any way to check float/double for NaN? I can't find any.

I've checked standard C way - its not working:

if (fValue ≠ fValue)

Also I can't find any special function.

Let the power of C++ be with you.

MrK45 said:
if (fValue ≠ fValue)

Does not work for me either anymore, since some years.
But there are related STL functions, for example:

#include <cmath>

if (!std::isfinite(fValue))

Advertisement

In modern C standards there is

bool std::isnan(fValue)

But I'm asking about solution for Angelscript…

Let the power of C++ be with you.

There is no built-in way for checking for NaN. But you can easiliy register a function for it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement