fpclassify

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at fpclassify.

Returns the floating-point classification of the argument.

int fpclassify(   
   /* floating-point */ x   
);  
  
int fpclassify(   
   float x   
); // C++ only  
  
int fpclassify(   
   double x   
); // C++ only  
  
int fpclassify(   
   long double x   
); // C++ only  
  

Parameters

x
The floating-point value to test.

fpclassify returns an integer value that indicates the floating-point class of the argument x. This table shows the possible values returned by fpclassify, defined in <math.h>.

ValueDescription
FP_NANA quiet, signaling, or indeterminate NaN
FP_INFINITEA positive or negative infinity
FP_NORMALA positive or negative normalized non-zero value
FP_SUBNORMALA positive or negative denormalized value
FP_ZEROA positive or negative zero value

In C, fpclassify is a macro; in C++, fpclassify is a function overloaded using argument types of float, double, or long double. In either case, the value returned depends on the effective type of the argument expression, and not on any intermediate representation. For example, a normal double or long double value can become an infinity, denormal, or zero value when converted to a float.

Function/MacroRequired header (C)Required header (C++)
fpclassify<math.h><math.h> or <cmath>

The fpclassify macro and fpclassify functions conform to the C99 and C++11 specifications. For more compatibility information, see Compatibility.

Floating-Point Support
isnan, _isnan, _isnanf

Show: