Previous Page
Next Page

isnormal

Tests whether a given floating-point value is normalized

#include <math.h>
int isnormal ( float x  );
int isnormal ( double x  );
int isnormal ( long double x  );

The macro isnormal( ) yields a nonzero value (that is, TRue) if its argument's value is a normalized floating-point number. Otherwise, isnormal( ) yields 0. The argument must be a real floating-point type. The rule that floating-point types are promoted to at least double precision for mathematical calculations does not apply here; the argument's properties are determined based on its representation in its actual semantic type.

Example

double maximum( double a, double b )
{
  if ( isnormal( a ) && isnormal( b ) )    // Handle normal case first.
    return ( a >= b ) ? a : b ;

  else if ( isnan( a ) || isnan( b ) )
  {
    /* ... */

See Also

fpclassify( ), isfinite( ), isinf( ), isnan( ), signbit( )


Previous Page
Next Page