SDL_scalbn(3)

πŸ’– SDL_scalbn β€” the glow-up button for your doubles πŸ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual, and today's main character is SDL_scalbn. She scales your number by a power of two. That's it. That's the whole job. And she does it flawlessly. ✨


✨ NAME ✨

SDL_scalbn β€” scale x by an integer power of two. lowkey the simplest slay in the whole math library 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

double SDL_scalbn(double x, int n);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: it multiplies x by the *n*th power of the floating point radix β€” and the radix is always 2, no cap, every single time. πŸ’…

The domain situation:

  • Domain: -INF <= x <= INF,
  • n integer

The range situation:

  • Range: -INF <= y <= INF

Important tea: this function operates on double-precision floating point values. If you're rocking single-precision floats, go hold hands with SDL_scalbnf instead, she's literally right there. πŸŽ€


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • x β€” floating point value to be scaled.
  • n β€” integer exponent.

⭐ RETURN VALUE ⭐

Returns x * 2^n. That's the whole answer. Beautiful. Iconic. No notes. πŸ˜­πŸ’–


🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. Any thread. All the threads. The threads are eating good tonight. 🧚


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. So if you're on something older... bestie. Time to update. πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ


and that's the page, bestie!! this one came to you straight from the Simple Directmedia Layer girlies, version SDL 3.4.18 β€” and yeah, this manual page is literally named SDL_scalbn(3) too, we're keeping it consistent around here. go forth and scale responsibly πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from