C ++ version isnormal ()

Is there a C ++ version for anomalous, isnan and so C functions? I know I can use C functions from C ++, but I'm always curious to see if there are some C ++ alternatives.

+2


source to share


5 answers


I don't know as far as I know. Doesn't look like STL. Since this is a simple feature, I would assume they didn't want to waste time replacing it. The old C version works fine. I would say just keep using C isnormal ().



+1


source


These are included in the <cmath>

C ++ 0x draft:



template <class T> int fpclassify(T x);
template <class T> bool isfinite(T x);
template <class T> bool isinf(T x);
template <class T> bool isnan(T x);
template <class T> bool isnormal(T x);

      

+5


source


There is no such function in stl. You can check it in the link: cppreference

Functionality

C was posted in C ++, and the API - through headers without the "* .h" postfix and with the "c" prefix Example

<cstdlib>

      

But I'm sure you know about it.

If you're looking for something similar, you'll probably find many similar C functions in the amazing boost library . Most of the classes will be introduced in the new C ++ standard, so it's worth exploring.

boost

+2


source


Exact repetitive question

Note: isnan, isnormal, and similars are fairly easy to override as due to the IEEE standards there are simple rules (followed in the C ++ float / double implementation) to check if a number is "finite" or not. those. if "a is nan", then "a is! = a" .

+1


source


+1


source







All Articles