fixcos(3)

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

✨ NAME ✨

okay bestie, welcome to fixcos(3) from the Allegro manual β€” yes, the Allegro game programming library is in the building. πŸ’–

  • fixcos β€” Fixed point cosine of binary angles. Part of the Allegro game programming library, periodt.

🌸 SYNOPSIS 🌸

#include <allegro.h>

fixed fixcos(fixed x);

like, you include the header and call fixcos with a fixed value. easy. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

This function finds the cosine of a value using a lookup table. The input value must be a fixed point binary angle. No cap. Example:

fixed angle;
float result;

/* Set the binary angle to 45 degrees. */
angle = itofix(32);
/* The cosine of 45 degrees is about 0.7071. */
result = fixtof(fixcos(angle));
ASSERT(result > 0.7 && result < 0.71);

So you set a binary angle with itofix(32) for 45 degrees, then fixcos it, then fixtof the result, and the assertion checks it's between 0.7 and 0.71. πŸ’…


πŸŽ€ RETURN VALUE πŸŽ€

Returns the cosine of a fixed point binary format angle. The return value will be in radians. So like, even though the input is a binary angle, the answer comes back in radians β€” don't get it twisted, bestie. πŸ”₯


🌈 SEE ALSO 🌈

tiny detail: the original SEE ALSO line has a stray leading comma before ex12bit(3). iconic, honestly. πŸ’€

that's the whole fixcos(3) page, bestie. source/version: Allegro, version 4.4.3. date: the original footer didn't list one, so no made-up date here β€” just pure Allegro energy. πŸ«ΆπŸ’–

πŸ“¦ where this page comes from