std::remainder

From cppreference.com
< cpp‎ | numeric‎ | math
 
 
 
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)
(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

[edit] Parameters

x, y - values of floating-point or integral types

[edit] Return value

Remainder of dividing arguments.

[edit] See also

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