Function SDL_trunc

pub unsafe extern "C" fn SDL_trunc(x: f64) -> f64 
Available on crate feature dep_sdl3 only.
Expand description

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.

§Parameters

  • x: floating point value.

§Return value

Returns x truncated to an integer.

§Thread safety

It is safe to call this function from any thread.

§Availability

This function is available since SDL 3.2.0.

§See also