fdim, fdimf, fdiml

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at fdim, fdimf, fdiml.

Determines the positive difference between the first and second values.

double fdim(  
   double x,   
   double y  
);  
  
float fdim(  
   float x,   
   float y  
); //C++ only  
  
long double fdim(  
   long double x,   
   long double y  
); //C++ only  
  
float fdimf(  
   float x,   
   float y  
);  
  
long double fdiml(  
   long double x,   
   long double y  
);  
  

Parameters

[in] x
The first value.

[in] y
The second value.

Returns the positive difference between x and y:

Return valueScenario
x-yif x > y
0if x <= y

Otherwise, may return one of the following errors:

IssueReturn
Overflow range error+HUGE_VAL, +HUGE_VALF, or +HUGE_VALL
Underflow range errorcorrect value (after rounding)
x or y is NaNNaN

Errors are reported as specified in _matherr.

Because C++ allows overloading, you can call overloads of fdim that take and return float and long double types. In a C program, fdim always takes and returns a double.

Except for the NaN handling, this function is equivalent to fmax, fmaxf, fmaxl(x-y, 0).

FunctionC headerC++ header
fdim, fdimf, fdiml<math.h><cmath>

For additional compatibility information, see Compatibility.

Alphabetical Function Reference
fmax, fmaxf, fmaxl
abs, labs, llabs, _abs64

Show: