HPlogo HP-UX Reference > F

fdim(3M)

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

Technical documentation

 » Table of Contents

 » Index

NAME

fdim(), fdimf(), fdiml(), fdimw(), fdimq() — positive difference functions

SYNOPSIS

#include <math.h>

double fdim(double x, double y);

Itanium(R)-based System Only

float fdimf(float x, float y);

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

extended fdimw(extended x, extended y);

quad fdimq(quad x, quad y);

DESCRIPTION

The fdim() function determines the positive difference between its arguments.

Itanium-based System Only

fdimf() is a float version of fdim(); it takes float arguments and returns a float result.

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

fdimw() is an extended version of fdim(); it takes extended arguments and returns an extended result.

fdimq() is equivalent to fdiml() on HP-UX systems.

USAGE

To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. To use (for Itanium-based systems) fdimw() or fdimq(), compile with the -fpwidetypes option. Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line.

RETURN VALUE

The fdim() function returns the positive difference between x and y.

If x > y, fdim() returns x - y (and raises any exceptions resulting from the subtraction).

If x <= y, fdim() returns +zero.

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

If both arguments are NaNs, fdim() returns NaN.

fdim() returns a positively signed infinity in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions.

ERRORS

No errors are defined.

STANDARDS CONFORMANCE

fdim(), fdimf(), fdiml() : ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')