Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/fdim"

From cppreference.com
< cpp‎ | numeric‎ | math
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh)
m (Shorten template names. Use {{lc}} where appropriate.)
Line 1: Line 1:
 
{{cpp/title|fdim}}
 
{{cpp/title|fdim}}
 
{{cpp/numeric/math/navbar}}
 
{{cpp/numeric/math/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list header | cmath}}
+
{{dcl header | cmath}}
{{ddcl list item | notes={{mark since c++11}} | num=1 |
+
{{dcl | notes={{mark since c++11}} | num=1 |
 
float      fdim( float x, float y );
 
float      fdim( float x, float y );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} | num=2 |
+
{{dcl | notes={{mark since c++11}} | num=2 |
 
double      fdim( double x, double y );
 
double      fdim( double x, double y );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} | num=3 |
+
{{dcl | notes={{mark since c++11}} | num=3 |
 
long double fdim( long double x, long double y );
 
long double fdim( long double x, long double y );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} | num=4 |
+
{{dcl | notes={{mark since c++11}} | num=4 |
 
Promoted    fdim( Arithmetic x, Arithmetic y );
 
Promoted    fdim( Arithmetic x, Arithmetic y );
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
 
Returns the positive difference between {{c|x}} and {{c|y}}.
 
Returns the positive difference between {{c|x}} and {{c|y}}.
Line 23: Line 23:
  
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | x, y | floating point value}}
+
{{par | x, y | floating point value}}
{{param list end}}
+
{{par end}}
  
 
===Return value===
 
===Return value===
Line 33: Line 33:
 
===See also===
 
===See also===
  
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/numeric/math/dcl list abs}}
+
{{dsc inc | cpp/numeric/math/dcl list abs}}
{{dcl list template | cpp/numeric/math/dcl list fmax}}
+
{{dsc inc | cpp/numeric/math/dcl list fmax}}
{{dcl list end}}
+
{{dsc end}}
  
 
[[de:cpp/numeric/math/fdim]]
 
[[de:cpp/numeric/math/fdim]]

Revision as of 19:19, 31 May 2013

 
 
 
 
Defined in header <cmath>
float       fdim( float x, float y );
(1) (since C++11)
double      fdim( double x, double y );
(2) (since C++11)
long double fdim( long double x, long double y );
(3) (since C++11)
Promoted    fdim( Arithmetic x, Arithmetic y );
(4) (since C++11)

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.

4) If any argument has integral type, it is cast to double. If any other argument is long double, then the return type is long double, otherwise it is double.

Parameters

x, y - floating point value

Return value

The positive difference value.

See also

Template:cpp/numeric/math/dcl list absTemplate:cpp/numeric/math/dcl list fmax