SDL_floor(3)

πŸ’– SDL_floor(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's called SDL_floor and it is exactly what it sounds like β€” no cap 🫢


✨ NAME ✨

SDL_floor β€” compute the floor of x. that's it. that's the whole job. she's a specialist πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

double SDL_floor(double x);

look at her. one include, one function, one double in, one double out. clean girl aesthetic fr fr ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so the floor of x is the largest integer y such that y <= x β€” which is a fancy way of saying you round x down to the nearest integer. always down. never up. she does not care about your feelings about .9. πŸ“‰

like, 3.9 becomes 3. -2.1 becomes -3. the floor is literally the floor, you can't go below it, that's the vibe 🧚

Domain: -INF <= x <= INF

Range: -INF <= y <= INF, y integer

heads up bestie β€” this function operates on double-precision floating point values. if you're working with single-precision floats, go use SDL_floorf instead. don't mix them up, it's giving precision loss 😭

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • x β€” a floating point value. that's the one getting floored. she's the main character here πŸ‘‘

⭐ RETURN VALUE ⭐

returns the floor of x. literally. that's the whole return. no hidden surprises, no error codes, no drama. iconic behaviour honestly 🌈


πŸ’œ THREAD SAFETY πŸ’œ

it is safe to call this function from any thread. go wild. spawn all the threads. she can handle it πŸ’…βœ¨


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on an older SDL and it's not linking, that's why bestie, not you πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

go read those too, they're her sisters and they all ate 🫢


Simple Directmedia Layer β€’ SDL 3.4.18 β€’ SDL_floor(3)

and that's the whole page bestie, mwah πŸ’‹ thanks for reading, now go round some numbers down, ily πŸ“βœ¨

πŸ“¦ where this page comes from