summaryrefslogtreecommitdiff
path: root/include/cppunit/portability/FloatingPoint.h
blob: 56138fa3a1bfab5bf8a1add37042937e49ec52ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef CPPUNIT_PORTABILITY_FLOATINGPOINT_H_INCLUDED
#define CPPUNIT_PORTABILITY_FLOATINGPOINT_H_INCLUDED

#include <cppunit/Portability.h>
#include <cmath>

CPPUNIT_NS_BEGIN

inline bool floatingPointIsUnordered( double x )
{
    return std::isnan(x);
}


/// \brief Tests if a floating-point is finite.
/// @return \c true if x is neither a NaN, nor +inf, nor -inf, \c false otherwise.
inline int floatingPointIsFinite( double x )
{
    return std::isfinite(x);
}

CPPUNIT_NS_END

#endif // CPPUNIT_PORTABILITY_FLOATINGPOINT_H_INCLUDED