SplitScript reference / Float / round

Float.round

Method

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

Rounds to the nearest integral value, with halfway values rounded to even.

Ties choose the even neighboring integer, avoiding a systematic upward or downward bias. Infinity and NaN are returned unchanged.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Round a displayed measurement

let visibleDistance = 12.5.round()