fixfloor(3alleg4)

✨ fixfloor(3alleg4) ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's a tiny lil function page and honestly? it's giving "short but essential". let's go πŸŽ€


🌸 NAME 🌸

fixfloor β€” returns the greatest integer not greater than x. from the Allegro game programming library, no cap πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

int fixfloor(fixed x);

πŸ’… DESCRIPTION πŸ’…

so basically fixfloor hands you back the greatest integer that is not greater than x. that's the whole vibe. lowkey what it actually means is: it rounds towards negative infinity 🫢 like, always down, always toward the void, never toward zero. periodt.

here's the example, bestie, look at it:

int result;
/* This will put 33 into `result'. */
result = fixfloor(itofix(100) / 3);
/* And this will round down to 16. */
result = fixfloor(itofix(100) / 6);

see how itofix(100) / 3 slides a clean 33 into result? iconic. and itofix(100) / 6? that one rounds down to 16. the way it just... floors it 😭✨

heads up: this is fixed-point math, not float math β€” the fixed type and itofix are the Allegro way of doing decimals without decimals. iykyk πŸ’€

🌈 SEE ALSO 🌈


and that's the whole page, babes πŸ¦‹ this was pulled straight from Allegro version 4.4.3, dated with love, and it lives under the name fixfloor(3alleg4). go floor something. slay πŸ’…πŸ’–