Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fmod(3M)

fabs(3M)

isinf(3M)

isnan(3M)

remainder(3M)

NAME

remainder(), drem() − remainder function

SYNOPSIS

#include <math.h>

double remainder(double x, double y);

double drem(double x, double y);

DESCRIPTION

The remainder() function returns the floating-point remainder r = x − ny when y is nonzero.  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 remainder() is independent of the rounding mode. 

The drem() function is identical to the remainder() function.  It is provided for backward compatibility. 

To use these functions, link in the math library by specifying −lm on the compiler or linker command line. 

RETURN VALUE

If y is ±INFINITY and x is not ±INFINITY, remainder() returns x.

If x is ±zero and y is nonzero, remainder() returns x.

If x or y is NaN, remainder() returns NaN. 

If y is zero, remainder() returns NaN and sets errno to [EDOM]. 

If x is ±INFINITY, remainder() returns NaN and sets errno to [EDOM]. 

ERRORS

If remainder() fails, errno is set to one of the following values. 

[EDOM] y is zero. 

[EDOM] x is ±INFINITY. 

SEE ALSO

fmod(3M), fabs(3M), isinf(3M), isnan(3M). 

STANDARDS CONFORMANCE

remainder(): SVID3, XPG4.2

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026