[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

fdim, fdimf, or fdiml Subroutine

Purpose

Computes the positive difference between two floating-point numbers.

Syntax

#include <math.h>

double fdim (x, y)
double x;
double y;

float fdimf (x, y)
float x;
float y;

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

Description

The fdim, fdimf, and fdiml subroutines determine the positive difference between their arguments. If x is greater than y, x - y is returned. If x is less than or equal to y, +0 is returned.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutyines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

x Specifies the value to be computed.
y Specifies the value to be computed.

Return Values

Upon successful completion, the fdim, fdimf, and fdiml subroutines return the positive difference value.

If x-y is positive and overflows, a range error occurs and the fdim, fdimf, and fdiml subroutines return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.

If x-y is positive and underflows, a range error may occur, and 0.0 is returned.

If x or y is NaN, a NaN is returned.

Related Information

feclearexcept Subroutine, fetestexcept Subroutine, fmax, fmaxf, or fmaxl Subroutine, and madd, msub, mult, mdiv, pow, gcd, invert, rpow, msqrt, mcmp, move, min, omin, fmin, m_in, mout, omout, fmout, m_out, sdiv, or itom Subroutine.

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]