fpclassify()

Classifies floating-point numbers.

  
#include <math.h>
int fpclassify(x);
 
Parameter

x

A value of type float, double, or long double.

Remarks

This macro returns the type of a floating-point value as an integral value:

Use this macro to check for errors in floating point computations. This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of fpclassify()

#include <math>

#include <stdio.h>

void mypow(double x, double y)

{

double p;

p = pow(x, y);

switch (fpclassify(p))

{

case FP_ZERO:

case FP_NORMAL:

case FP_SUBNORMAL:

printf("%f", p);

break;

default:

printf("error in pow()");

break;

}

}