SDL_fmod(3)

✨ SDL_fmod ✨

ok so bestie, welcome to the SDL_fmod page from the SDL3 functions manual πŸ’– this is the one that gives you the floating-point remainder of x / y, and we're gonna go through it together, no stress.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

double SDL_fmod(double x, double y);

πŸ’… DESCRIPTION πŸ’…

So basically it divides x by y, and returns the remainder. That's it. That's the whole vibe. 🫢

The domain (aka the stuff you're allowed to feed it) is:

  • -INF <= x <= INF
  • -INF <= y <= INF
  • y != 0

And the range (aka what you can get back) is:

  • -y <= z <= y

Lowkey important: this function operates on double-precision floating point values. If you're working with single-precision floats, you want SDL_fmodf instead β€” don't come for me, that's just how it is. 😌


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • x β€” the numerator. the top of the fraction, the main character of the division. πŸ‘‘
  • y β€” the denominator. Must not be 0. fr fr, zero is not the move here. πŸ’€

⭐ RETURN VALUE ⭐

Returns the remainder of x / y. slay. πŸ’–


πŸ¦‹ THREAD SAFETY πŸ¦‹

It is safe to call this function from any thread. go off, multitask, thread it up, it's fine. ✨


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. not ancient, not brand new β€” just right. 🧚


πŸ‘‘ SEE ALSO πŸ‘‘


reminder bestie: keep y away from 0 or the whole thing falls apart. it's giving undefined behaviour energy and we do NOT want that. 😭

and that's the page!! mwah πŸ’‹ this came from the Simple Directmedia Layer crew β€” SDL 3.4.18, dated with the SDL_fmod(3) footer vibe β€” love them, follow them, they ate. πŸ«Άβœ¨πŸ’…

πŸ“¦ where this page comes from