al_fixsin(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’– al_fixsin(3) πŸ’–

okay bestie, welcome to the Allegro 5 API β€” yes, that Allegro, the game library, and this page is all about al_fixsin from the <allegro5/allegro.h> gang. pull up a chair, we're doing trig but make it fixed point πŸŽ€


✨ NAME ✨

al_fixsin β€” literally the Allegro 5 API function that hands you a sine. that's it, that's the name, she's simple and she knows it πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

al_fixed al_fixsin(al_fixed x);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this function finds the sine of a value, and it does it with a lookup table (iconic, efficient, no cap). the one thing you must remember is that the input value has to be a fixed point binary angle β€” not radians, not degrees, a binary angle. periodt.

Example:

al_fixed angle;
int result;

/* Set the binary angle to 90 degrees. */
angle = al_itofix(64);

/* The sine of 90 degrees is one. */
result = al_fixtoi(al_fixsin(angle));
assert(result == 1);

like, look at her go 😭 al_itofix(64) is 90 degrees, al_fixsin does its lil table lookup, al_fixtoi converts back, and boom β€” the sine of 90 degrees is one. the assert agrees, so you know it's fr fr.


⭐ RETURN VALUE ⭐

returns the sine of a fixed point binary format angle, as a fixed point value. so the return type is al_fixed, and yes the vibe check passes 🫢


πŸ’€ friendly reminder: feed it a fixed point binary angle, not whatever random float you had lying around. the lookup table is not gonna fix your units for you, babe.

and that's the whole page, bestie 🌈 this lil cutie comes to you straight from the Allegro reference manual β€” source and all, dated however the fine folks at Allegro felt like it (no date on this one, we stay mysterious ✨). go make something cute with it. mwah πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms