fixacos(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– fixacos(3) β€” the Allegro manual's little inverse-cosine baddie πŸ’–

okay bestie, gather round, because we're talking about fixacos from the Allegro game programming library β€” yes, that Allegro, the one that's been serving fixed-point math since forever. πŸŽ€


✨ NAME ✨

fixacos β€” fixed point inverse cosine lookup table. She's part of the Allegro game programming library, and she's here to find your angles for you. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

fixed fixacos(fixed x);

that's it. one include, one function call, and you're literally off to the races. πŸ’…


🧚 DESCRIPTION 🧚

so what does she actually do? fixacos finds the inverse cosine of a value, and she does it with a lookup table β€” no cap, that's the whole vibe. fast, fixed-point, iconic.

here's the tea you actually need to remember, though: the input value must be a fixed point radian. ⚠️

and the inverse cosine is defined only in the domain from -1 to 1. that's her whole range, periodt. if you feed her something outside of that input range, she will:

  • set errno to EDOM 😭
  • return zero

like, she's not mad, she's just setting boundaries. 🫢

example time, because examples ate:

fixed result;

/* Sets `result' to binary angle 128. */
result = fixacos(itofix(-1));

look at that. itofix(-1) goes in, binary angle 128 comes out, main character energy fr fr. ✨


πŸ”₯ RETURN VALUE πŸ”₯

she returns the inverse sine of a fixed point value β€” measured as a fixed point binary format angle. πŸŽ€ (yes, the docs say inverse sine here, and we're keeping it exactly as written, bestie, we don't edit the ancestors.)

and if the input was out of range? she hands you back zero. πŸ™ˆ

also super important: all return values of this function will be in the range 0 to 128. every single one. that's the vibe check, and it passed. βœ…


πŸ‘‘ SEE ALSO πŸ‘‘

literally nothing else listed here, so go forth and cosine, queen. πŸ’œ


and that's the whole page, bestie!! this little slice of the Allegro manual is from version 4.4.3, and yes, fixacos(3) is the icon, the moment, the section three legend. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from