Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

Guardian Native C Library Calls (f) fmod(3)
NAME
fmod - Computes the modulo remainder of a division operation
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <math.h>
double fmod(
double x,
double y
);
PARAMETERS
x Species the double value that is the numerator of the division.
y Species the double value that is the denominator of the division.
DESCRIPTION
The fmod() function computes the modulo oating-point remainder of x/y. The fmod( ) function
returns the value x -(i*y) for some i such that if y is nonzero, the result has the same sign as x and
magnitude less than the magnitude of y.
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values
in the native environment. IEEE values can include NaN and innity, and the sign of 0.0 (zero)
can be either positive or negative. Refer to the fp_class(3) reference page for a description of
IEEE value classes.
Guardian functions are available to convert between oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
RETURN VALUES
Upon successful completion, the fmod() function returns the modulo oating-point remainder of
the division of x by y.
For IEEE oating-point values, if x or y is NaN, NaN is returned. If the value of x is positive or
negative innity, or if the value of y is 0.0 (zero), the fmod() function returns NaN and sets
errno to [EDOM]. If the value of y is nonzero and the value of x is positive or negative zero, the
fmod() function returns the value of x. If the value of x is not positive or negative innity but the
value of y is positive or negative innity, the fmod() function returns the value of x.
For Tandem oating-point values, if the value of y is 0.0 (zero), the fmod() function returns 0.0
(zero).
If the correct value would cause underow, 0.0 (zero) is returned.
ERRORS
If any of the following conditions occurs, the fmod() function sets errno to the corresponding
value:
[EDOM] The y parameter is 0.0 (zero) or the x parameter is positive or negative innity.
527192-007 Hewlett-Packard Company 227