SDL_modff(3)

πŸ’– SDL_modff(3) β€” the SDL3 girlies' guide to splitting floats πŸ’–

okay so bestie, welcome to the SDL_modff(3) page from the SDL3 FUNCTIONS collection πŸŽ€ this one's a lil cutie, no cap.


✨ NAME ✨

SDL_modff β€” split x into integer and fractional parts πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

float SDL_modff(float x, float *y);

πŸ’… DESCRIPTION πŸ’…

so this function is the single-precision floating point girlie πŸ’β€β™€οΈ she operates on float values only, periodt. if you're working with double-precision floats, you want her cousin SDL_modf instead, iykyk ✨


🫢 FUNCTION PARAMETERS 🫢

  • x β€” your floating point value, the main character of this whole operation πŸ‘‘
  • y β€” an output pointer, and she's where you stash the integer part of x πŸŽ€

⭐ RETURN VALUE ⭐

she hands you back the fractional part of x β€” that's the vibe 🌈


πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this function from any thread πŸ’― so go off, spawn whatever threads you want, she's built different fr fr


🧚 AVAILABILITY 🧚

this function is available since SDL 3.2.0 ⏳ (yes she's a newer icon, respect her)


🌈 SEE ALSO 🌈

  • SDL_modf(3) β€” the double-precision sister πŸ’œ
  • SDL_truncf(3) β€” when you just wanna yeet the fraction entirely πŸ™ˆ
  • SDL_fmodf(3) β€” for that modulo moment πŸ“

lowkey reminder: y is a pointer, so pass her a valid address or it's giving undefined behaviour 😭 you've been warned bestie

okay that's the whole page, and as a lil sign-off: this one comes to you from Simple Directmedia Layer, version SDL 3.4.18 β€” mwah, go split some floats, you got this πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from