fixasin(3)
πΈ NAME πΈ
fixasin β fixed point inverse sine lookup table π and it lives in the Allegro game programming library, periodt.
β¨ SYNOPSIS β¨
#include <allegro.h>
fixed fixasin(fixed x);
π DESCRIPTION π
okay so bestie, here's the tea β β this function finds the inverse sine of a value, and it does it with a lookup table, not by doing any fancy math on the fly. iykyk.
The input value must be a fixed point value. like, that's not optional, that's the whole vibe.
The inverse sine is defined only in the domain from -1 to 1. that's it. that's the range of inputs it will accept. π«Ά
π¨ BESTIE LISTEN. If you feed it anything outside that input range, the function will seterrnotoEDOMand return zero. no crash, no drama, justEDOMand a zero. but you will know. π
Example, because examples are the main character:
float angle;
fixed val;
/* Sets `val' to a right binary angle (`64'). */
val = fixasin(itofix(1));
/* Sets `angle' to 0.2405. */
angle = fixtof(fixmul(fixasin(ftofix(0.238)), fixtorad_r));
/* This will trigger the assert. */
val = fixasin(ftofix(-1.09));
ASSERT(!errno);
see that last bit? yeah. that ftofix(-1.09) is out of range, errno gets set, and the ASSERT is going off. π don't be that girl.
π RETURN VALUE π
It returns the inverse sine of a fixed point value, measured as a fixed point binary format angle β¨ β or zero if the input was out of the range (you know, the EDOM situation we just talked about).
And ngl, this part is iconic: all return values of this function will be in the range -64 to 64. every single one. no cap. π
π¦ SEE ALSO π¦
soβ¦ there's literally nothing listed here. no cross references, no friends, no links. it's giving solo era π this section is just standing there in the manual being mysterious. π
and that's the whole page, bestie π«Ά this one's from the Allegro manual, version 4.4.3, and the page is fixasin(3). no date stamped on it either, which is lowkey iconic of it β¨ go forth and only ever pass it values between -1 and 1 ππ§
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms