Trunc
Rounds toward zero.
Module: Math
Signature
rux
func Trunc(x: float64) -> float64;
func Trunc(x: float32) -> float32;Parameters
| Name | Type | Description |
|---|---|---|
x | float64 / float32 | The value to round. |
Returns
The integer part of x, discarding any fractional part, still represented as a floating-point number. Trunc(-0.4) keeps its sign and is -0.0. Infinities and NaNs pass through unchanged.
Example
rux
import Math::Trunc;
let a = Trunc(3.9); // 3.0
let b = Trunc(-3.9); // -3.0