Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
fmod(3) Guardian Native C Library Calls Reference Manual
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 Specifies the double value that is the numerator of the division.
y Specifies the double value that is the denominator of the division.
DESCRIPTION
The fmod() function computes the modulo floating-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 floating-point and Tandem floating-point values
in the native environment. IEEE values can include NaN and infinity, 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 floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
RETURN VALUES
Upon successful completion, the fmod() function returns the modulo floating-point remainder of
the division of x by y.
For IEEE floating-point values, if x or y is NaN, NaN is returned. If the value of x is positive or
negative infinity, 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 infinity but the
value of y is positive or negative infinity, the fmod() function returns the value of x.
For Tandem floating-point values, if the value of y is 0.0 (zero), the fmod() function returns 0.0
(zero).
If the correct value would cause underflow, 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 infinity.
2−24 Hewlett-Packard Company 527192-005