Chapter Contents

Previous

Next
fdim

fdim



Compute the floating point positive difference

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATIONS
SEE ALSO


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);


DESCRIPTION

fdim computes the positive difference of its arguments x and y. The positive difference is defined as x-y if x is greater than y, and 0 otherwise, unless either argument is a NaN, in which case the result is a NaN.

The function name fdimf should be used for float arguments, and fdiml for long double arguments. Alternately, if the header file tgmath.h is included, fdim may be used with any numeric argument type.


RETURN VALUE

fdim returns the positive difference of x and y, as defined above.


IMPLEMENTATIONS

For binary floating-point, fdim is implemented as a built-in function unless it is undefined by a #undef statement.


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.