Capy-Bearer Documentation

trunc

lib call

Capy

function trunc(value : f32) f32
function trunc(value : f64) f64

Description

trunc() rounds toward zero, so it behaves like floor() for positive and like ceil() for negative numbers. s64(value) performs the same rounding when converting.

Parameters

value : a floating-point number

Return Values

value with its fractional part removed, in the same type.

Example

Capy

print(trunc(2.9), " ", trunc(-2.9), "\n")

Output

2 -2