Name

fdim, fdimf, fdiml
- positive difference

Library

libm.lib

Synopsis

  #include <math.h>
  double fdim (double x, double y);
  float fdimf (float x, float y);
  long double fdiml (long double x, long double y);

Detailed description

The fdim, fdimf, and fdiml functions return the positive difference between x and y. That is, if x- y is positive, then x- y is returned. If either x or y is an NaN, then an NaN is returned. Otherwise, the result is +0.0.

Examples

#include <math.h>
int main( void )
{
   double x1 = 0, x2 = -9, y;
   y = fdim( x1, x2 );
   printf( "fdim(%f , %f) = %f\n", x1, x2, y );
   y = fdimf( x1, x2 );
   printf( "fdimf(%f , %f) = %f\n", x1, x2, y );
   y = fdiml( x1, x2 );
   printf( "fdiml(%f , %f) = %f\n", x1, x2, y );
}

         

Output

fdim ( 0, -9 ) = 9
fdimf( 0, -9 ) = 9
fdiml( 0, -9 ) = 9

         


See also

fabs, fmax, math

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top