1fixdiv(3)                       Allegro manual                       fixdiv(3)
2
3
4

NAME

6       fixdiv - Fixed point division. Allegro game programming library.
7

SYNOPSIS

9       #include <allegro.h>
10
11
12       fixed fixdiv(fixed x, fixed y);
13

DESCRIPTION

15       A  fixed  point  value can be divided by an integer with the normal `/'
16       operator. To divide two fixed point values, though, you must  use  this
17       function.  If  a  division  by zero occurs, `errno' will be set and the
18       maximum possible value will be returned, but `errno' is not cleared  if
19       the  operation  is successful. This means that if you are going to test
20       for division by zero you should set `errno=0' before calling  fixdiv().
21       Example:
22
23          fixed result;
24          /* This will put 0.06060 `result'. */
25          result = fixdiv(itofix(2), itofix(33));
26          /* This will put 0 into `result'. */
27          result = fixdiv(0, itofix(-30));
28          /* Sets `errno' and puts -32768 into `result'. */
29          result = fixdiv(itofix(-100), itofix(0));
30          ASSERT(!errno); /* This will fail. */
31

RETURN VALUE

33       Returns  the result of dividing `x' by `y'. If `y' is zero, returns the
34       maximum possible fixed point value and sets `errno' to ERANGE.
35
36

SEE ALSO

38       fixadd(3), fixsub(3), fixmul(3), exfixed(3)
39
40
41
42Allegro                          version 4.4.3                       fixdiv(3)
Impressum