sdlRound function
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_lround.
\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_roundf \sa SDL_lround \sa SDL_floor \sa SDL_ceil \sa SDL_trunc
extern SDL_DECLSPEC double SDLCALL SDL_round(double x)
Implementation
double sdlRound(double x) {
final sdlRoundLookupFunction = libSdl3.lookupFunction<
Double Function(Double x), double Function(double x)>('SDL_round');
return sdlRoundLookupFunction(x);
}