SDL_atan(3)
β¨ SDL_atan β¨
okay bestie, welcome to the SDL_atan(3) page β yeah it's a whole page in the SDL3 FUNCTIONS fam, and honestly? it's giving math girlie. let's get into it π
πΈ NAME πΈ
SDL_atan β compute the arc tangent of x. that's it, that's the job π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_stdinc.h>
double SDL_atan(double x);
π¦ DESCRIPTION π¦
so here's the vibe: the definition of y = atan(x) is x = tan(y). they're literally two sides of the same coin, no cap. π₯
Domain: -INF <= x <= INF
Range: -Pi/2 <= y <= Pi/2
this one works on double-precision floating point values, so if you're out here with single-precision floats, you want SDL_atanf instead. different function, different fit β¨
and if you're trying to calculate the arc tangent of y / x? that's a whole different situation β go use SDL_atan2, she's built for exactly that. π«Ά
β οΈ okay important thing, listen up: this function may use a different approximation across different versions, platforms and configurations. like, 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 expecting bit-for-bit identical results across every setup, bestie, that's not the energy here. π
π FUNCTION PARAMETERS π
xβ floating point value. that's the one and only ingredient, queen π
π RETURN VALUE π
returns the arc tangent of x in radians, or 0 if x = 0. (zero in, zero out, iconic behaviour honestly) π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go wild, no drama, everybody's invited π«Άβ¨
β AVAILABILITY β
this function is available since SDL 3.2.0. if you're on something olderβ¦ girl, upgrade π
π SEE ALSO π
the whole trig friend group, love that for them π
and that's the page, bestie!! π this little gem comes to you from Simple Directmedia Layer, version SDL 3.4.18 β so if you see that version floating around in your headers, that's the source of all this trig excellence. mwah, go compute some angles β¨π¦π
π¦ 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