1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
8 <<fdim>>, <<fdimf>>---positive difference
16 double fdim(double <[x]>, double <[y]>);
17 float fdimf(float <[x]>, float <[y]>);
20 The <<fdim>> functions determine the positive difference between their
22 . <[x]> - <[y]> if <[x]> > <[y]>, or
24 . +0 if <[x]> <= <[y]>, or
27 . +0 if <[x]> $\leq$ <[y]>, or
29 . NAN if either argument is NAN.
30 A range error may occur.
33 The <<fdim>> functions return the positive difference value.
42 #ifndef _DOUBLE_IS_32BITS
45 double fdim(double x
, double y
)
52 if (__fpclassifyd(x
) == FP_NAN
) return(x
);
53 if (__fpclassifyd(y
) == FP_NAN
) return(y
);
55 return x
> y
? x
- y
: 0.0;
58 #endif /* _DOUBLE_IS_32BITS */