fixacos(3alleg4)

πŸ’– fixacos β€” the fixed point inverse cosine lookup table, bestie πŸ’–

Allegro manual Β· fixacos(3alleg4) Β· a whole function from the Allegro game programming library πŸŽ€


✨ NAME ✨

fixacos β€” fixed point inverse cosine lookup table. Allegro game programming library. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

fixed fixacos(fixed x);

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so. this function finds the inverse cosine of a value using a lookup table. no cap, it's literally a table lookup. 🧚

your input value must be a fixed point radian. and listen β€” inverse cosine is only defined in the domain from -1 to 1. that's it, that's the whole vibe check. if you go outside that input range, the function will set errno to EDOM and return zero. πŸ’€

example, because we love a demonstration:

fixed result;

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

πŸ’… RETURN VALUE πŸ’…

returns the inverse sine of a fixed point value, measured as fixed point binary format angle, or zero if the input was out of range. (yes, the page says inverse sine β€” that's what it says, i'm just the messenger πŸ™ˆ)

all return values of this function will be in the range 0 to 128. every single one. periodt. ⭐


🌈 SEE ALSO 🌈

that's it, bestie β€” nothing else listed on this one 🫢


lowkey the whole thing in one breath: radian-ish fixed input, -1 to 1 only, else errno = EDOM and you get a zero back. πŸ’œ

Allegro version 4.4.3 Β· fixacos(3alleg4) β€” mwah, tysm for reading, go slay some fixed point math πŸ’–βœ¨πŸŽ€