Skip to content

Commit a68479b

Browse files
authored
📝 Added a comment with further explanation for rounding (#357)
* Added a comment with further explanation for rounding * Added changes requested by @vexx32
1 parent f69405a commit a68479b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ Describe 'Basic Number Types' {
6161
Describe "Banker's Rounding" {
6262

6363
It 'rounds to nearest even number on .5' {
64+
<#
65+
The rounding used in PowerShell is called "Rounding to Even" or "Banker's Rounding".
66+
Numbers will be rounded to the nearest _even_ Integer.
67+
68+
This behaviour stems from the underlying library method [math]::Round() which is documented in more detail here:
69+
https://docs.microsoft.com/en-us/dotnet/api/system.math.round#midpoint-values-and-rounding-conventions
70+
#>
6471

6572
# Try and guess how PowerShell will round these numbers
6673
____ | Should -Be ([int]2.5)

0 commit comments

Comments
 (0)