The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

NAME

remainder - remainder function

SYNOPSIS

#include <math.h>

double remainder(double x, double y);

DESCRIPTION

The remainder() function returns 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 |  = ½ , the value n is chosen to be even.

The behaviour of remainder() is independent of the rounding mode.

RETURN VALUE

The remainder() function returns the floating point remainder r = x - ny when y is non-zero.

When y is 0, remainder() returns (NaN or equivalent if available) and sets errno to [EDOM].

If the value of x is ±Inf, remainder() returns NaN and sets errno to [EDOM].

If x or y is NaN, then the function returns NaN and errno may be set to [EDOM].

ERRORS

The remainder() function will fail if:

[EDOM]
The y argument is 0 or the x argument is positive or negative infinity.

The remainder() function may fail if:

[EDOM]
The x or y argument is NaN.

EXAMPLES

None.

APPLICATION USAGE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

abs(), <math.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]