drem(3M) DG/UX 5.4R3.00 drem(3M)
NAME
drem - IEEE floating-point remainder
SYNOPSIS
#include <ieeefp.h> /* for IEEE environment */
or
#include <math.h> /* for System V environment */
double drem (x,y)
double x, y;
DESCRIPTION
drem returns the remainder of x/y as specified by IEEE Standard 754
for Binary Floating-Point Arithmetic. The remainder r is calculated
as
r = x - n * y
where n is the integer nearest the exact value of x/y. If the
absolute value of x/y is .5, then n is the even integer nearest the
result of x/y. Since the IEEE standard requires that the exact value
of x/y be used in the calculation, the 'round nearest' rounding mode
is in effect throughout the execution of the drem function. The
remainder is always considered to be exact, so inexact exceptions are
never raised.
Considerations for Threads Programming
+---------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+---------+-----------------------------+
|drem | Y N N |
+---------+-----------------------------+
DIAGNOSTICS
The IEEE standard defines drem(x, 0) and drem(infinity, y) to be
invalid operations. In addition, this implementation considers
drem(x, y) to be an invalid operation when x/y results in infinity or
double-precision overflow. These operations raise an 'invalid
operation' exception, which results in signal SIGFPE if traps are
enabled and a NaN otherwise.
SEE ALSO
reentrant(3), fpgetround(3C), isnan(3C).
BUGS
This implementation of drem does not allow exceptional values to be
fixed by a trap handler.
Licensed material--property of copyright holder(s) 1