HPlogo HP-UX Reference Volume 4 of 5 > f

fmod(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

fmod(), fmodf() — remainder functions

SYNOPSIS

#include <math.h>

double fmod(double x, double y);

float fmodf(float x, float y);

DESCRIPTION

The fmod() function returns the floating-point remainder (f) of the division of x by y, where f has the same sign as x, such that x=iy+f for some integer i, and |f| < |y|.

fmodf() is a float version of fmod(); it takes float arguments and returns a float result. To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options.

fmodf() is not specified by any standard, but it is named in accordance with the conventions specified in the "Future Library Directions" section of the ANSI C standard.

To use these functions, make sure your program includes <math.h>, and 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, fmod() returns x.

If x is ±zero and y is a nonzero number, fmod() returns x.

If x or y is NaN, fmod() returns NaN.

If the correct value after rounding would be smaller in magnitude than MINDOUBLE, fmod() returns zero.

If y is zero, fmod() returns NaN and sets errno to [EDOM].

If x is ±INFINITY, fmod() returns NaN and sets errno to [EDOM].

ERRORS

If fmod() fails, errno is set to one of the following values.

[EDOM]

y is zero.

[EDOM]

x is ±INFINITY.

STANDARDS CONFORMANCE

fmod(): SVID3, XPG4.2, ANSI C

© Hewlett-Packard Development Company, L.P.