SDL_lround(3)

πŸ’« SDL_lround πŸ’«

ok so bestie, welcome to the SDL_lround page from the SDL3 FUNCTIONS lineup πŸŽ€ she rounds a double to the nearest long and honestly? she ate.


✨ NAME ✨

SDL_lround β€” Round x to the nearest integer representable as a long πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

long SDL_lround(double x);

like yes that's it, that's the whole vibe πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

So what she does: rounds x to the nearest integer. And the lil plot twist β€” values that are halfway between integers get rounded away from zero. no indecision, no "idk maybe", she picks a side and commits πŸ”₯

Domain: -INF <= x <= INF

Range: MIN_LONG <= y <= MAX_LONG

ngl this one is the double-precision floating point girlie ✨ so if you're rolling with single-precision floats, you want SDL_lroundf instead. And if what you actually want back is a floating-point type rather than a long, then SDL_round is your bestie. iykyk πŸ’«


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • x β€” floating point value. that's her. that's the whole input 🌸

🌈 RETURN VALUE 🌈

Returns the nearest integer to x. slay, no notes πŸ’…


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. go off, multithreaded queen πŸ‘‘


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older... girl, upgrade πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹


okay that's the whole page, mwah πŸ’‹ this iconic lil number comes to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 🫢 go round some numbers, bestie, you got this βœ¨πŸ’–

πŸ“¦ where this page comes from