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

NAME

6       ftofix  -  Converts a floating point value to fixed point. Allegro game
7       programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       fixed ftofix(double x);
14

DESCRIPTION

16       Converts a floating point value to fixed point. Unlike  itofix(),  this
17       function  clamps  values which could overflow the type conversion, set‐
18       ting `errno' to ERANGE in the process if this happens. Example:
19
20          fixed number;
21          number = itofix(-40000);
22          ASSERT(fixfloor(number) == -32768);
23          number = itofix(64000);
24          ASSERT(fixfloor(number) == 32767);
25          ASSERT(!errno); /* This will fail. */
26

RETURN VALUE

28       Returns the value of the floating point value converted to fixed  point
29       clamping overflows (and setting `errno').
30
31

SEE ALSO

33       fixtof(3),  itofix(3), fixtoi(3), exfixed(3), exrotscl(3), exspline(3),
34       exupdate(3)
35
36
37
38Allegro                          version 4.4.3                       ftofix(3)
Impressum