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. πβ¨ππ¦πΈ
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms