Skip to content

Commit

Permalink
📝 Added a comment with further explanation for rounding (#357)
Browse files Browse the repository at this point in the history
* Added a comment with further explanation for rounding

* Added changes requested by @vexx32
  • Loading branch information
jschpp committed Feb 4, 2020
1 parent f69405a commit a68479b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1
Expand Up @@ -61,6 +61,13 @@ Describe 'Basic Number Types' {
Describe "Banker's Rounding" {

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

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

0 comments on commit a68479b

Please sign in to comment.