sdlTrunc function

double sdlTrunc(
  1. double x
)

Truncate x to an integer.

Rounds x to the next closest integer to 0. This is equivalent to removing the fractional part of x, leaving only the integer part.

Domain: -INF <= x <= INF

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

This function operates on double-precision floating point values, use SDL_truncf for single-precision floats.

\param x floating point value. \returns x truncated to an integer.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_truncf \sa SDL_fmod \sa SDL_ceil \sa SDL_floor \sa SDL_round \sa SDL_lround

extern SDL_DECLSPEC double SDLCALL SDL_trunc(double x)

Implementation

double sdlTrunc(double x) {
  final sdlTruncLookupFunction = libSdl3.lookupFunction<
      Double Function(Double x), double Function(double x)>('SDL_trunc');
  return sdlTruncLookupFunction(x);
}