DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fdim(S-osr5)


fdim -- return positive difference between two arguments

Syntax

   cc [flag ...] file ...  -lm [library ...]
   

#include <math.h>

double fdim(double x, double y);

float fdimf(float x, float y);

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

Description

fdim, fdimf and fdiml return the positive difference between the x and y arguments. If x is greater than y then the difference between the two is returned. If x is less than or equal to y then +0 is returned.

Errors

If x is +INFINITY and y is -INFINITY (or vice versa) fdim, fdimf and fdiml return IEEE NaN on systems that support it and raise the invalid operation exception. Otherwise, they return 0. errno is set to ERANGE.

If x - y overflows fdim, fdimf and fdiml return ±HUGE_VAL, ±HUGE_VALF or ±HUGE_VALL (respectively) and errno is set to ERANGE.

On systems that support IEEE NaN, if the argument to any of these functions is a quiet NaN, that value is returned. If the argument is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM.

If the program was compiled with the -Xt compilation mode, a value that will compare equal to HUGE is returned instead of HUGE_VAL. These error handling procedures may be changed with the function matherr.

See also

cc(CP), math(M), matherr(S-osr5),
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005