sdlRoundf function stdinc

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 single-precision floating point values, use SDL_round for double-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.2.0.

\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 = _libSdl
      .lookupFunction<Float Function(Float x), double Function(double x)>(
        'SDL_roundf',
      );
  return sdlRoundfLookupFunction(x);
}