SDL_truncf(3)
π SDL_truncf π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_truncf(3), and honestly? this one is so chill. it's giving "small function, big slay." let's get into it π
β¨ NAME β¨
SDL_truncf β chop x down to an integer, fr fr.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
float SDL_truncf(float x);
π¦ DESCRIPTION π¦
so what it does is: it rounds x to the next closest integer toward 0. same energy as just deleting the fractional part of x and leaving the integer part sitting there all alone. like, the decimal gets ghosted. π
Domain: -INF <= x <= INF
Range: -INF <= y <= INF, y integer
heads up though β this one is strictly for single-precision floating point values. if you're on that double-precision grind, you want SDL_trunc instead. iykyk β¨
π FUNCTION PARAMETERS π
xβ a floating point value. that's it. that's the whole parameter. icon behavior.
π RETURN VALUE π
returns x truncated to an integer. no drama, no surprises, just vibes. π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go wild, bestie. multithread it. it does not care. π«Ά
β AVAILABILITY β
this function has been available since SDL 3.2.0. so if you're on anything olderβ¦ yeah, no. update. π
π SEE ALSO π
ok real talk, this is your friendly reminder that all the rounding cousins exist and each one rounds a different direction. don't just grab the first one you see. vibe check your rounding. π₯
and that's the whole page!! this little baddie ships with Simple Directmedia Layer, SDL 3.4.18 edition β that's the source and the version, bestie, so you know exactly what you're working with. go truncate something. slay. πβ¨πΈπ¦ππ π«Ά
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms