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