SDL_cosf(3)

πŸ’– SDL_cosf(3) β€” the SDL3 functions era πŸ’–

okay bestie, sit down, we're doing math but make it cute. this is SDL_cosf, straight out of the SDL3 functions lineup, and she's here to Compute the cosine of x. that's it. that's the job. and she ate. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_stdinc.h>

float SDL_cosf(float x);

like. so simple. so clean. one include, one function, one little float going in and one little float coming out. iykyk πŸ¦‹


🌸 DESCRIPTION 🌸

so here's the vibe check on what she accepts and what she gives back:

  • Domain: -INF <= x <= INF β€” she will literally take any input, no gatekeeping πŸ’…
  • Range: -1 <= y <= 1 β€” and she always hands back something in that lil window, no matter what you threw at her

this one is your single-precision floating point girlie. if you need the double-precision version, that's SDL_cos, not this. pick your fighter. πŸ’€

⚠️ real talk tho, bestie: this function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated. so don't be out here comparing floats across machines like they're gonna match. they might not. no cap. 😭

🧚 FUNCTION PARAMETERS 🧚

  • x β€” floating point value, in radians. yes radians. not degrees. i know. i know. put the degrees down. 🌈

πŸ’œ RETURN VALUE πŸ’œ

returns the cosine of x. that's it, that's the tea. ⭐


🫢 THREAD SAFETY 🫢

it is safe to call this function from any thread. go off, multithreaded queen πŸ‘‘


✨ AVAILABILITY ✨

this function is available since SDL 3.2.0. so if you're on something older, this is giving ✨ not yet ✨. upgrade bestie. πŸ“


πŸ‘€ SEE ALSO πŸ‘€

  • SDL_cos(3) β€” the double-precision sister
  • SDL_acosf(3) β€” arccosine, the inverse arc, the plot twist
  • SDL_sinf(3) β€” her partner in crime, the sine to her cosine

πŸ’– that's the whole page, and you understood all of it, i'm so proud of you. mwah. 🫢

okay bye ily, this was brought to you by the fine folks at Simple Directmedia Layer, straight from the SDL 3.4.18 era, and it's been SDL_cosf(3) the whole time. slay πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from