al_ftofix(3)
π NAME π
al_ftofix β Allegro 5 API. This page is from the Library Functions Manual, bestie, and itβs giving βfloat goes fixed-pointβ energy π
β¨
π¦ SYNOPSIS π¦
#include <allegro5/allegro.h>
al_fixed al_ftofix(double x);
πΈ DESCRIPTION πΈ
Okay so al_ftofix converts a floating point value to fixed point. Unlike al_itofix(3), this function clamps values which could overflow the type conversion, setting Allegroβs errno to ERANGE in the process if this happens. No cap, that clamp is the whole personality π«Ά
Example, copied exactly because we do not mess with code:
al_fixed number;
number = al_itofix(-40000);
assert(al_fixfloor(number) == -32768);
number = al_itofix(64000);
assert(al_fixfloor(number) == 32767);
assert(!al_get_errno()); /* This will fail. */
π RETURN VALUE π
Returns the value of the floating point value converted to fixed point clamping overflows (and setting Allegroβs errno). So you get the converted value back, plus the errno side-eye when overflow clamping kicks in πβ¨
π SEE ALSO π
Source/version cutie: Allegro reference manual; page tag: al_ftofix(3); date: not listed in the footer, bestie π«Άπ
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms