HPlogo HP-UX Reference > F

fmod(3M)

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

Technical documentation

 » Table of Contents

 » Index

NAME

fmod(), fmodf(), fmodl(), fmodw(), fmodq() — remainder functions

SYNOPSIS

#include <math.h>

double fmod(double x, double y);

float fmodf(float x, float y);

Itanium(R)-based System Only

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

extended fmodw(extended x, extended y);

quad fmodq(quad x, quad 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.

Itanium-based System Only

fmodl() is a long double version of fmod(); it takes long double arguments and returns a long double result.

fmodw() is an extended version of fmod(); it takes extended arguments and returns an extended result.

fmodq() is equivalent to fmodl() 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 Itanium-based systems) fmodw() or fmodq(), compile also with the -fpwidetypes option.

To use any of these functions, 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, 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 x is ±INFINITY or y is zero, fmod() returns NaN and raises the invalid exception.

ERRORS

If y is zero or x is infinite, fmod() sets errno to [EDOM].

Itanium-based System

HP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, compile with the +Olibmerrno option.

STANDARDS CONFORMANCE

fmod() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')

fmodf(), fmodl() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')