##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# fdim

From cppreference.com
< c‎ | numeric‎ | math

Defined in header `<math.h>` |  |
float fdimf( float x, float y ); |  | (since C99)
double fdim( double x, double y ); |  | (since C99)
long double fdiml( long double x, long double y ); |  | (since C99)

Returns the positive difference between x and y. This could be implemented as fmax (x - y, 0), so if x ≤ y, the result is always equals to 0, otherwise it is x - y.

### [edit] Parameters

x, y | - | floating point value

### [edit] Return value

The positive difference value.

### [edit] See also

abs labs llabs imaxabs (C99) | computes absolute value of an integral value (|x|) (function) [edit]
fmax (C99) | larger of two floating point values (function) [edit]
C++ documentation for fdim

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/numeric/math/fdim&oldid=62576"