REMAINDER(3M) Mathematical Library Functions REMAINDER(3M)
remainder, remainderf, remainderl - remainder function
c99 [ flag... ] file... -lm [ library... ]
#include <math.h>
double remainder(double x, double y);
float remainderf(float x, float y);
long double remainderl(long double x, long double y);
These functions return the floating point remainder r = x - ny when y
is non-zero. The value n is the integral value nearest the exact
value x/y. When |n - x/y| = 1/2, the value n is chosen to be even.
The behavior of remainder() is independent of the rounding mode.
Upon successful completion, these functions return the floating point
remainder r = x - ny when y is non-zero.
If x or y is NaN, a NaN is returned.
If x is infinite or y is 0 and the other is non-NaN, a domain error
occurs and a NaN is returned.
These functions will fail if:
Domain Error
The x argument is +-Inf, or the y argument is +-0 and
the other argument is non-NaN.
If the integer expression (math_errhandling &
MATH_ERREXCEPT) is non-zero, then the invalid
floating-point exception is raised.
The remainder() function sets errno to EDOM if y
argument is 0 or the x argument is positive or
negative infinity.
An application wanting to check for error situations can set errno to
0 before calling remainder(). On return, if errno is non-zero, an
error has occurred. The remainderf() and remainderl() functions do
not set errno.
See attributes(7) for descriptions of the following attributes:
+----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+----------------------------+-----------------------------+
|Interface Stability | Standard |
+----------------------------+-----------------------------+
|MT-Level | MT-Safe |
+----------------------------+-----------------------------+
abs(3C), div(3C), feclearexcept(3M), fetestexcept(3M), attributes(7),
standards(7)
SunOS 5.11 July 12, 2006 REMAINDER(3M)
NAME
remainder, remainderf, remainderl - remainder function
SYNOPSIS
c99 [ flag... ] file... -lm [ library... ]
#include <math.h>
double remainder(double x, double y);
float remainderf(float x, float y);
long double remainderl(long double x, long double y);
DESCRIPTION
These functions return the floating point remainder r = x - ny when y
is non-zero. The value n is the integral value nearest the exact
value x/y. When |n - x/y| = 1/2, the value n is chosen to be even.
The behavior of remainder() is independent of the rounding mode.
RETURN VALUES
Upon successful completion, these functions return the floating point
remainder r = x - ny when y is non-zero.
If x or y is NaN, a NaN is returned.
If x is infinite or y is 0 and the other is non-NaN, a domain error
occurs and a NaN is returned.
ERRORS
These functions will fail if:
Domain Error
The x argument is +-Inf, or the y argument is +-0 and
the other argument is non-NaN.
If the integer expression (math_errhandling &
MATH_ERREXCEPT) is non-zero, then the invalid
floating-point exception is raised.
The remainder() function sets errno to EDOM if y
argument is 0 or the x argument is positive or
negative infinity.
USAGE
An application wanting to check for error situations can set errno to
0 before calling remainder(). On return, if errno is non-zero, an
error has occurred. The remainderf() and remainderl() functions do
not set errno.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+----------------------------+-----------------------------+
|Interface Stability | Standard |
+----------------------------+-----------------------------+
|MT-Level | MT-Safe |
+----------------------------+-----------------------------+
SEE ALSO
abs(3C), div(3C), feclearexcept(3M), fetestexcept(3M), attributes(7),
standards(7)
SunOS 5.11 July 12, 2006 REMAINDER(3M)