sdlRoundf function

double sdlRoundf(
  1. double x
)

Round x to the nearest integer.

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

Domain: -INF <= x <= INF

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

This function operates on double-precision floating point values, use SDL_roundf for single-precision floats. To get the result as an integer type, use SDL_lroundf.

\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_round \sa SDL_lroundf \sa SDL_floorf \sa SDL_ceilf \sa SDL_truncf

extern SDL_DECLSPEC float SDLCALL SDL_roundf(float x)

Implementation

double sdlRoundf(double x) {
  final sdlRoundfLookupFunction = libSdl3.lookupFunction<
      Float Function(Float x), double Function(double x)>('SDL_roundf');
  return sdlRoundfLookupFunction(x);
}