remainder

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
remainder
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       remainderf( float x, float y );
(since C99)
double      remainder( double x, double y );
(since C99)
long double remainderl( long double x, long double y );
(since C99)

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 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.

[edit] Parameters

x, y - floating point values

[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