Is there a C++ version of the isnormal, isnan and so C functions? I know I can use the C functions from C++, but I'm always interested to know if there are some C++-only alternatives.
            Asked
            
        
        
            Active
            
        
            Viewed 2,087 times
        
    3 Answers
5
            
            
        They're included in <cmath> in the 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);
 
    
    
        Stephen Canon
        
- 103,815
- 19
- 183
- 269
- 
                    1Have they been included in the published version of the standard? – static_rtti Feb 19 '13 at 13:55
2
            
            
        There is no such a functionality in stl. You could check that in reference: cppreference
C functionalities was placed in C++ and APIs are available through headers without postfix "*.h" and with prefix "c" example
<cstdlib>
But I'm certain You know about it.
If You're looking for something simmilar you probably would find many C like functions in amazing boost library. Most of classes would be introduced to new C++ standard so its worth to learn.
 
    
    
        bua
        
- 4,761
- 1
- 26
- 32
- 
                    Maybe not. You (http://stackoverflow.com/users/147845/you) seems to prefer PHP and Web based questions. – graham.reeds Oct 05 '09 at 14:02
1
            Not as far as I know. Doesn't look like there's one in the STL. Since that's such a simple function I would guess they didn't want to take the time to replace it. The old C version works fine. I would say just continue to use the C isnormal().
 
    
    
        Daniel Bingham
        
- 12,414
- 18
- 67
- 93
