SDL_atanf(3)

πŸ’– SDL_atanf β€” bestie edition πŸ’–

okay so this is a page from the SDL3 FUNCTIONS manual, and we're talking about SDL_atanf. yes it's trig, no you don't have to be scared, i got you 🫢


✨ NAME ✨

SDL_atanf β€” Compute the arc tangent of x. that's it, that's the whole job πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

float SDL_atanf(float x);

✨ DESCRIPTION ✨

so like, the definition of y = atan(x) is x = tan(y). they're literally the same statement wearing different outfits πŸ’«

  • Domain: -INF <= x <= INF
  • Range: -Pi/2 <= y <= Pi/2

this one operates on single-precision floating point values, bestie. if you need the double-precision version, go use SDL_atan for dboule-precision floats. (yes, i said it exactly like that, iykyk 😭)

and if what you actually want is the arc tangent of y / x? that's a different girl, use SDL_atan2f 🌸

⚠️ important vibe check: 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 no cap, don't assume it's bit-identical everywhere. it is not. πŸ™ˆ

✨ FUNCTION PARAMETERS ✨

  • x β€” floating point value. that's the one and only thing she asks for πŸŽ€

✨ RETURN VALUE ✨

Returns arc tangent of of x in radians, or 0 if x = 0. zero in, zero out, iconic behavior fr fr ✨


✨ THREAD SAFETY ✨

It is safe to call this function from any thread. periodt. call it from all of them at once, she does not care πŸ‘‘


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. if your SDL is older than that, she's not there yet, sorry bestie 😭


✨ SEE ALSO ✨


Simple Directmedia Layer made this, SDL 3.4.18 is the version, and this lil page is dated SDL_atanf(3) β€” thanks for reading my ted talk, go compute some angles πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from