SDL_log(3)

πŸ’– SDL_log(3) β€” the "natural log" girlies' moment πŸ’–

okay so bestie, welcome to SDL_log, a page straight out of the SDL3 FUNCTIONS lineup. It's giving math. It's giving logarithms. It's giving "I compute the natural logarithm of x and I do it fabulously." Let's get into it. πŸ¦‹


✨ NAME ✨

SDL_log β€” compute the natural logarithm of x. 🌸


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

double SDL_log(double x);

yes bestie, one header, one function, one double in, one double out. clean. iconic. πŸ’…


✨ DESCRIPTION ✨

Okay so the rules of the road, and you need to know these:

  • Domain: 0 < x <= INF
  • Range: -INF <= y <= INF
Not me being dramatic but it is an ERROR for x to be less than or equal to 0. Like, genuinely an error. Do not. πŸ™ˆ

This function operates on double-precision floating point values. If you're working with single-precision floats, use SDL_logf instead β€” she's right there, she's waiting. 🫢

Now the spicy part: this function may use a different approximation across different versions, platforms and configurations. That means β€” and I'm quoting the facts here β€” 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-for-bit identical everywhere. πŸ’€


✨ FUNCTION PARAMETERS ✨

  • x β€” floating point value. Must be greater than 0. That's the whole assignment. That's the vibe check. If x isn't greater than 0, we're not doing this. ⭐

✨ RETURN VALUE ✨

Returns the natural logarithm of x. that's it. that's the tea. πŸŽ€


✨ THREAD SAFETY ✨

It is safe to call this function from any thread. πŸ”₯

Periodt. Go wild. Call her from literally any thread you want, she's not gonna crash the party. πŸ‘‘


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. ✨

If you're on something older than that, bestie, I'm so sorry, she does not exist yet. Time to update. 😭


✨ SEE ALSO ✨

the whole logarithm friend group. iykyk. 🌈


and that's the page!! tysm for reading, bestie β€” go log something (something greater than 0, obviously πŸ“). this was brought to you by Simple Directmedia Layer, version SDL 3.4.18, and by the letter e. mwah. πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from