SplitScript reference / Float / truncate

Float.truncate

Method

T.truncate() -> T where T: Float

Rounds this value toward zero to an integral value.

Positive fractions round down and negative fractions round up. Signed zero preserves its sign. Infinity and NaN are returned unchanged.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Remove the fractional part of a measured time

let wholeSeconds = 12.75.truncate()