fixtan(3alleg4)

πŸ’– fixtan β€” bestie edition πŸ’–

ok so this is a page from the Allegro manual, and today's main character is fixtan. it lives in section 3alleg4 and it's here to hand you the tangent of a binary angle, fixed point style. no cap. ✨


🌸 NAME 🌸

fixtan β€” fixed point tangent of binary angles. part of the Allegro game programming library. that's the whole vibe check. πŸ¦‹


✨ SYNOPSIS ✨

#include <allegro.h>

fixed fixtan(fixed x);

like. that's it. that's the whole function signature. iconic behavior honestly. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

ok so here's the tea: fixtan finds the tangent of a value, and it does it using a lookup table. not a calculator, not a prayer, a table. slay.

⚠️ important bestie: the input value must be a fixed point binary angle. don't come in here with radians or degrees, she will not know what to do with them. 🫢

and here's the example from the page, copied exactly so you can run it and see the precision for yourself:

fixed angle, res_a, res_b;
float dif;

angle = itofix(37);
/* Prove that tan(angle) == sin(angle) / cos(angle). */
res_a = fixdiv(fixsin(angle), fixcos(angle));
res_b = fixtan(angle);
dif = fixtof(fixsub(res_a, res_b));
allegro_message("Precision error: %f\n", dif);

the way that this literally proves tan(angle) == sin(angle) / cos(angle) by comparing the two paths and printing the difference? that's the whole assignment. 🧚


πŸ’œ RETURN VALUE πŸ’œ

returns the tangent of a fixed point binary format angle.

and heads up, this part matters: the return value will be in radians. so yes, you fed her a binary angle and she hands you back radians. that's the deal, that's the arrangement, take it or leave it. 😭


🌈 SEE ALSO 🌈

ngl bestie, this one's a little lonely β€” there are no cross-references listed here. just you, fixtan, and the lookup table. no thoughts, head empty, tan computed. πŸ’€


and that's a wrap on the fixtan page from the Allegro manual, version 4.4.3, filed under fixtan(3alleg4). go compute some tangents, you absolute legend. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ