The
std::is_floating_point template of C++ STL is used to check whether the given type is a floating point value or not. It returns a boolean value showing the same.
Syntax:
template < class T > struct is_floating_point;
Parameter: This template accepts a single parameter
T (Trait class) to check whether T is a floating point type.
Return Value: This template returns a boolean value as shown below:
- True: if the type is a float.
- False: if the type is a not float value.
Below programs illustrate the std::is_floating_point template in C++ STL:
Program 1:
Output:
is_floating_point:
char: false
int: false
float: true
Program 2:
Output:
is_floating_point:
double: true
bool: false
long int: false
Program 3: