HPlogo HP-UX Reference Volume 4 of 5 > r

remainder(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

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 a nonzero number. 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.

This function meets the requirement of the IEEE-754 standard for a remainder operation. The ISO/ANSI C committee has approved the remainder() function for inclusion in the C9X draft standard.

To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. Make sure your program includes <math.h>. 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 a nonzero number, 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.

STANDARDS CONFORMANCE

remainder(): SVID3, XPG4.2, IEEE-754

© Hewlett-Packard Development Company, L.P.