std::fdim

From Cppreference

Jump to: navigation, search
Defined in header <cmath>

float       fdim( float x, float y );
(C++11 feature)
double      fdim( double x, double y );
(C++11 feature)
long double fdim( long double x, long double y );
(C++11 feature)

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(int)
labs
llabs
computes absolute value of an integral value (|x|)
(function)
fmax (C++11)
larger of two floating point values
(function)