HPlogo HP-UX Reference > R

remainder(3M)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

remainder(), remainderf(), remainderl(), remainderw(), remainderq(), drem(), dremf(), dreml(), dremw(), dremq() — remainder functions

SYNOPSIS

#include <math.h>

double remainder(double x, double y);

HP Integrity Server Only

float remainderf(float x, float y);

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

extended remainderw(extended x, extended y);

quad remainderq(quad x, quad y);

double drem(double x, double y);

float dremf(float x, float y);

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

extended dremw(extended x, extended y);

quad dremq(quad x, quad 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() function is independent of the rounding mode.

Integrity Server Only

drem() is equivalent to remainder(). It is provided in HP-UX to facilitate importing code from other platforms.

remainderf() and dremf() are float versions of remainder() and drem(); they take float arguments and returns a float result.

remainderl() and dreml() are long double versions of remainder() and drem(); they take long double arguments and returns a long double result.

remainderw() and dremw() are extended version of remainder() and drem(); they take extended arguments and returns an extended result.

remainderq() and dremq() are equivalent to remainderl() and dreml() on HP-UX systems.

USAGE

To use these functions, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options.

To use (for Integrity servers) remainderw(), remainderq(), dremw(), or dremq(), compile also with the -fpwidetypes option.

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 raises the invalid exception.

If x is ±INFINITY, remainder() returns NaN and raises the invalid exception.

ERRORS

If y is zero or x is infinite, remainder() sets errno to EDOM.

Integrity Server Only

HP-UX libm functions on Integrity servers do not set errno by default. For errno setting, compile with the +Olibmerrno option and the (default) +Olibcalls option.

STANDARDS CONFORMANCE

remainder() : SVID3, XPG4.2, IEEE-754, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

remainderf(), remainderl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")