1fdim(3M)                Mathematical Library Functions                fdim(3M)
2
3
4

NAME

6       fdim,  fdimf, fdiml - compute positive difference between two floating-
7       point numbers
8

SYNOPSIS

10       c99 [ flag... ] file... -lm [ library... ]
11       #include <math.h>
12
13       double fdim(double x, double y);
14
15
16       float fdimf(float x, float y);
17
18
19       long double fdiml(long double x, long double y);
20
21

DESCRIPTION

23       These functions determine the positive difference between  their  argu‐
24       ments.  If  x  is greater than y, xy is returned. If x is less than or
25       equal to y, +0 is returned.
26

RETURN VALUES

28       Upon successful completion, these functions return the positive differ‐
29       ence value.
30
31
32       If  xy  is  positive  and  overflows, a range error occurs and fdim(),
33       fdimf(),  and  fdiml()  returns  the  value  of  the  macro   HUGE_VAL,
34       HUGE_VALF, and HUGE_VALL, respectively.
35
36
37       If x or y is NaN, a NaN is returned.
38

ERRORS

40       These functions will fail if:
41
42       Range Error    The result overflows.
43
44                      If    the   integer   expression   (math_errhandling   &
45                      MATH_ERREXCEPT) is non-zero, the overflow floating-point
46                      exception will be raised.
47
48

USAGE

50       An  application  wanting to check for exceptions should call feclearex‐
51       cept(FE_ALL_EXCEPT) before  calling  these  functions.  On  return,  if
52       fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
53       non-zero, an exception has been raised. An  application  should  either
54       examine the return value or check the floating point exception flags to
55       detect exceptions.
56

ATTRIBUTES

58       See attributes(5) for descriptions of the following attributes:
59
60
61
62
63       ┌─────────────────────────────┬─────────────────────────────┐
64       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
65       ├─────────────────────────────┼─────────────────────────────┤
66       │Interface Stability          │Standard                     │
67       ├─────────────────────────────┼─────────────────────────────┤
68       │MT-Level                     │MT-Safe                      │
69       └─────────────────────────────┴─────────────────────────────┘
70

SEE ALSO

72       feclearexcept(3M), fetestexcept(3M), fmax(3M), fmin(3M), math.h(3HEAD),
73       attributes(5), standards(5)
74
75
76
77SunOS 5.11                        12 Jul 2006                         fdim(3M)
Impressum