sdlLround function

int sdlLround(
  1. double x
)

Round x to the nearest integer representable as a long

Rounds x to the nearest integer. Values halfway between integers will be rounded away from zero.

Domain: -INF <= x <= INF

Range: MIN_LONG <= y <= MAX_LONG

This function operates on double-precision floating point values, use SDL_lround for single-precision floats. To get the result as a floating-point type, use SDL_round.

\param x floating point value. \returns the nearest integer to x.

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

\since This function is available since SDL 3.1.3.

\sa SDL_lroundf \sa SDL_round \sa SDL_floor \sa SDL_ceil \sa SDL_trunc

extern SDL_DECLSPEC long SDLCALL SDL_lround(double x)

Implementation

int sdlLround(double x) {
  final sdlLroundLookupFunction =
      libSdl3.lookupFunction<Int32 Function(Double x), int Function(double x)>(
          'SDL_lround');
  return sdlLroundLookupFunction(x);
}