mirror of
https://github.com/apple/swift-numerics
synced 2026-11-22 04:30:45 +00:00
Correct toNearestOrZero shift example
5 / 2 is exactly halfway between 2 and 3. The toNearestOrZero tie-breaking rule selects 2, the value with smaller magnitude.
This commit is contained in:
1 parent
899af71c02
commit
15eab09844
1 file changed
+1
-1
@@ -163,7 +163,7 @@ public enum RoundingRule {
|
||||
/// - `(-4).divided(by: 3, rounding: .toNearestOrZero)`
|
||||
/// is `-1`, because –4/3 = –1.3̅ is closer to –1 than it is to –2.
|
||||
///
|
||||
/// - `5.shifted(rightBy: 1, rounding: .toNearestOrZero)` is `3`,
|
||||
/// - `5.shifted(rightBy: 1, rounding: .toNearestOrZero)` is `2`,
|
||||
/// because 5/2 = 2.5 is equally close to 2 and 3, and 2 is closer to zero.
|
||||
case toNearestOrZero
|
||||
|
||||
|
||||
Reference in new issue
Block a user