SDL_scalbnf(3)

πŸ’– SDL_scalbnf(3) πŸ’–

okay bestie, we're in the SDL3 FUNCTIONS section of the manual and today's main character is SDL_scalbnf β€” she scales stuff. by powers of two. it's giving math girlie and honestly? she ate.


✨ NAME ✨

SDL_scalbnf β€” scale x by an integer power of two πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

float SDL_scalbnf(float x, int n);

like... that's it. two args. one float out. so clean, so iconic ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does is: she multiplies x by the *n*th power of the floating point radix β€” and the radix is always 2, no cap, every single time. 🫢

here's the domain vibe check:

  • Domain: -INF <= x <= INF
  • n integer
  • Range: -INF <= y <= INF

and psssst β€” this one is for single-precision floating point values, bestie. if you're on your double-precision era, you want SDL_scalbn instead. iykyk πŸ’…


πŸ“ FUNCTION PARAMETERS πŸ“

  • x β€” the floating point value that's about to get scaled. she's the canvas, she's the moment.
  • n β€” the integer exponent. this is the glow-up multiplier, the "how many times are we doubling" number.

πŸ‘‘ RETURN VALUE πŸ‘‘

she returns x * 2^n. literally that. no surprises, no plot twists, just math that shows up on time 🌈


πŸ”₯ THREAD SAFETY πŸ”₯

you can call this from any thread. any of them. all of them. she does not care, she does not get jealous, she is safe everywhere. multitasking queen πŸ‘‘


πŸ’œ AVAILABILITY πŸ’œ

this function has been available since SDL 3.2.0 β€” so if you're on something older, sorry babe, she wasn't born yet 😭


🌈 SEE ALSO 🌈

  • SDL_scalbn(3) β€” the double-precision sibling, same energy, more bits
  • SDL_powf(3) β€” when you need powers that aren't just "2, but again"

reminder bestie: the radix is always 2. don't come at her expecting base-10. she said what she said. πŸ’…

and that's the whole page!! sourced straight from Simple Directmedia Layer, SDL 3.4.18 era, page SDL_scalbnf(3) πŸŽ€ tysm for reading, go forth and scale responsibly, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from