al_fixasin(3alleg5)
π al_fixasin π
okay bestie, welcome to the Allegro 5 API corner of the manual, where we do trigonometry but make it fixed-point β¨
πΈ SYNOPSIS πΈ
#include <allegro5/allegro.h>
al_fixed al_fixasin(al_fixed x);
π¦ DESCRIPTION π¦
so like. this function hands you the inverse sine of a value, and it does it with a lookup table because we're efficient like that π
the input has gotta be a fixed point value, no cap. and here's the tea: inverse sine only exists in the domain from -1 to 1. that's it, that's the whole vibe check. if you feed it anything outside that range, the function sets Allegro's errno to EDOM and returns zero. not a crash, not a guess β just a polite little nope π
example time, periodt:
float angle;
al_fixed val;
/* Sets `val' to a right binary angle (64). */
val = al_fixasin(al_itofix(1));
/* Sets `angle' to 0.2405. */
angle = al_fixtof(al_fixmul(al_fixasin(al_ftofix(0.238)), al_fixtorad_r));
/* This will trigger the assert. */
val = al_fixasin(al_ftofix(-1.09));
assert(!al_get_errno());
π RETURN VALUE π
it gives you back the inverse sine of that fixed point value, measured as a fixed point binary format angle π or, if your input was out of range, you get zero instead.
and the range on the way out? every single return value of this function lands between -64 and 64. iconic. consistent. we love a bounded queen β
π«Ά quick recap bestie: fixed point in,-1to1only,EDOM+ zero if you stray, and the answer always comes home between-64and64. iykyk.
this was the Allegro reference manual page for al_fixasin(3alleg5) β mwah, go forth and sine responsibly πβ¨
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms