ftofix(3alleg)

ftofix3alleg

Converts a floating point value to fixed point. allegro game programming library.

Usage

#include <allegro.h>

fixed ftofix(double x);

Overview

Converts a floating point value to fixed point. Unlike itofix(), this function clamps values which could overflow the type conversion, setting `errno' to ERANGE in the process if this happens. Example:

   fixed number;
   number = itofix(-40000);
   ASSERT(fixfloor(number) == -32768);
   number = itofix(64000);
   ASSERT(fixfloor(number) == 32767);
   ASSERT(!errno); /* This will fail. */

Return value

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

Releases

4 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0

From liballegro-doc 2:4.2.2-2.2 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.