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 sisterSDL_acosf(3)β arccosine, the inverse arc, the plot twistSDL_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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms