fixasin(3)

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

🌸 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 set errno to EDOM and return zero. no crash, no drama, just EDOM and 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