Namespaces
Variants
Views
Actions

std::remainder

From cppreference.com
< cpp‎ | numeric‎ | math
Revision as of 13:59, 26 December 2013 by Nate (Talk | contribs)

 
 
 
Common mathematical functions
Functions
Basic operations
remainder
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Exponential functions
(C++11)
(C++11)
(C++11)
(C++11)
Power functions
(C++11)
(C++11)
Trigonometric and hyperbolic functions
(C++11)
(C++11)
(C++11)
Error and gamma functions
(C++11)
(C++11)
(C++11)
(C++11)
Nearest integer floating point operations
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Floating point manipulation functions
(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
Classification/Comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Macro constants
(C++11)(C++11)(C++11)(C++11)(C++11)
 
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( Arithmetic1 x, Arithmetic2 y );
(4) (since C++11)

Computes the signed remainder of the floating point division operation x/y.

Specifically, the returned value is x - n*y, where n is x/y rounded to the nearest integer, or the nearest even integer if x/y is halfway between two integers.

In contrast to std::fmod(), the returned value is not guaranteed to have the same sign as x.

If the returned value is 0, it will have the same sign as x.

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

remainder of the floating point division operation
(function) [edit]
computes quotient and remainder of integer division
(function) [edit]
C documentation for remainder