-
Notifications
You must be signed in to change notification settings - Fork 0
round
ffredyk edited this page Jul 23, 2026
·
1 revision
Math
Unary — round <number>.
round <number>
Rounds a number to the nearest integer. Midpoint values (.5) round to the nearest even number (banker's rounding). round 3.5 → 4, round 2.5 → 2. Auto-unwraps shared values.
Calls Math.Round(double, MidpointRounding.ToEven). This is the .NET default rounding strategy — also called "banker's rounding." It avoids statistical bias from always rounding .5 up.
round 3.2; // 3
round 3.7; // 4
round 3.5; // 4 (nearest even)
round 2.5; // 2 (nearest even)
round -1.5; // -2
// Snap to integer
_snapped = round _value;
// Percentage display
_pct = round (_score / _max * 100);Note: Midpoint rounding to even differs from Arma SQF which rounds .5 up. If you need always-round-.5-up behavior, use
floor (_x + 0.5)for positive numbers.
ReadOnly — pure computation. Safe from any scheduler.
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo