remainderl Function

Calculates x REM y as a double precision value.

Include

<math.h>

Prototype

long double remainderl(long double x, long double y);

Arguments

x
a double precision floating-point value
y
a double precision floating-point value

Return Value

Returns the remainder x REM y, being x − ny, where n is the nearest integer to the exact value of x/y. The rounding mode is ignored.

Remarks

If the remainder is 0, its sign shall be the same as that of x.

Example

#include <math.h>
#include <stdio.h>

int main(void)
{
  long double x,y,z;

  x = 7.0;
  y = 3.0;
  z = remainderl(x, y);
  printf("%Lf REM %Lf is %Lf\n", x, y, z);
}

Example Output

7.000000 REM 3.000000 is 1.000000