Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > F


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


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


#include <math.h>

double fdim(double x, double y);

HP Integrity Server 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);


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

Integrity Server 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.


To use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. To use (for Integrity servers) 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.


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.


No errors are defined.


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

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.