From a68479b005674d8c26b356528c3ff7d0c07b3e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6pp?= Date: Tue, 4 Feb 2020 17:33:41 +0100 Subject: [PATCH] :memo: Added a comment with further explanation for rounding (#357) * Added a comment with further explanation for rounding * Added changes requested by @vexx32 --- PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1 b/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1 index edffbfdbb..805195dd0 100644 --- a/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1 +++ b/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1 @@ -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)