1al_ftofix(3)                                                      al_ftofix(3)
2
3
4

NAME

6       al_ftofix - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              al_fixed al_ftofix(double x);
12

DESCRIPTION

14       Converts  a  floating point value to fixed point.  Unlike al_itofix(3),
15       this function clamps values which could overflow the  type  conversion,
16       setting Allegro’s errno to ERANGE in the process if this happens.
17
18       Example:
19
20              al_fixed number;
21
22              number = al_itofix(-40000);
23              assert(al_fixfloor(number) == -32768);
24
25              number = al_itofix(64000);
26              assert(al_fixfloor(number) == 32767);
27              assert(!al_get_errno()); /* This will fail. */
28

RETURN VALUE

30       Returns  the value of the floating point value converted to fixed point
31       clamping overflows (and setting Allegro’s errno).
32

SEE ALSO

34       al_fixtof(3), al_itofix(3), al_fixtoi(3), al_get_errno(3)
35
36
37
38Allegro reference manual                                          al_ftofix(3)
Impressum