SDL_modf(3)
β¨ SDL_modf β¨
okay bestie, welcome to the SDL_modf(3) page from the SDL3 FUNCTIONS collection π this one is short, sweet, and honestly kind of iconic β it splits a number in two like it's dividing the aux cord between you and your bestie π
πΈ NAME πΈ
SDL_modf β split x into integer and fractional parts. it's giving "cut the pizza, keep both slices" π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_stdinc.h>
double SDL_modf(double x, double *y);
like. one include. one function call. that's it. no cap β¨
π DESCRIPTION π
okay so here's the tea: this function operates on double-precision floating point values π so if you're rolling with doubles, you're in the right place.
but if you're a float girlie (single-precision), you do NOT belong here β you want SDL_modff instead. don't mix them up, i'm literally begging π
π FUNCTION PARAMETERS π
xβ floating point value. the number that's about to get split, main character energy fr π«yβ output pointer to store the integer part ofx. bestie this is a pointer, so hand it an address, not a value π
β RETURN VALUE β
Returns the fractional part of x π
so like, x goes in, and the function hands you back the fractional half while dropping the integer half into wherever *y points. teamwork. iconic. periodt π
π§ THREAD SAFETY π§
It is safe to call this function from any thread π«Ά no locks, no drama, no situationship with your mutex. call it from literally anywhere. slay π₯
π AVAILABILITY π
This function is available since SDL 3.2.0 β so if you're on anything older... yeah. update bestie, it's 3.2.0+, no excuses πΈ
π SEE ALSO π
iykyk β go read those next, they're all part of the same friend group π
lowkey reminder: y is a pointer and it's an output parameter, so make sure it points somewhere real before you call this. undefined behaviour is not the vibe, bestie π
kisses, this page was served up by Simple Directmedia Layer, version SDL 3.4.18 πβ¨π go forth and split those doubles, you absolute legend π¦π
π¦ 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