Namespaces
Variants
Views
Actions

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

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|remainder}}
 
{{cpp/title|remainder}}
 
{{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      remainder( float x, float y );
 
float      remainder( float x, float y );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} |num=2|
+
{{dcl | notes={{mark since c++11}} |num=2|
 
double      remainder( double x, double y );
 
double      remainder( double x, double y );
 
}}
 
}}
{{ddcl list item | notes={{mark since c++11}} |num=3|
+
{{dcl | notes={{mark since c++11}} |num=3|
 
long double remainder( long double x, long double y );
 
long double remainder( 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    remainder( Arithmetic x, Arithmetic y );
 
Promoted    remainder( Arithmetic x, Arithmetic y );
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
 
Computes the remainder of the floating point division operation {{c|x/y}}.  In difference to {{rlpt|fmod}}, the return type will be negative if {{c|fmod(x, y)>y/2}}.
 
Computes the remainder of the floating point division operation {{c|x/y}}.  In difference to {{rlpt|fmod}}, the return type will be negative if {{c|fmod(x, y)>y/2}}.
Line 21: Line 21:
 
4) If any argument has integral type, it is cast to {{c|double}}. If any other argument is {{c|long double}}, then the return type is {{c|long double}}, otherwise it is {{c|double}}
 
4) If any argument has integral type, it is cast to {{c|double}}. If any other argument is {{c|long double}}, then the return type is {{c|long double}}, otherwise it is {{c|double}}
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | x, y | floating point values}}
+
{{par | x, y | floating point values}}
{{param list end}}
+
{{par end}}
  
 
===Return value===
 
===Return value===
Line 31: Line 31:
 
===See also===
 
===See also===
  
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/numeric/math/dcl list fmod}}
+
{{dsc inc | cpp/numeric/math/dcl list fmod}}
{{dcl list template | cpp/numeric/math/dcl list div}}
+
{{dsc inc | cpp/numeric/math/dcl list div}}
{{dcl list end}}
+
{{dsc end}}
  
 
[[de:cpp/numeric/math/remainder]]
 
[[de:cpp/numeric/math/remainder]]

Revision as of 19:21, 31 May 2013

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

Computes the remainder of the floating point division operation x/y. In difference to fmod, the return type will be negative if fmod(x, y)>y/2.

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 values

Return value

remainder of dividing arguments

See also

Template:cpp/numeric/math/dcl list fmodTemplate:cpp/numeric/math/dcl list div