Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more explanation for banker's rounding in AboutNumbers #352

Closed
vexx32 opened this issue Jan 27, 2020 · 0 comments · Fixed by #357
Closed

Add more explanation for banker's rounding in AboutNumbers #352

vexx32 opened this issue Jan 27, 2020 · 0 comments · Fixed by #357
Labels
Category-Koans Invoking the Great Doubt Issue-Suggestion This should be added!

Comments

@vexx32
Copy link
Owner

vexx32 commented Jan 27, 2020

Describe "Koan(s) You Suggest"

The banker's rounding example is effective but lacking an explanation as to why that is the default behaviour. It's ultimately PowerShell following .NET's defined defaults there, but deserves an explanation as to why that may have been chosen as the default.

Context "The Scope of the Koans You Suggest"

We'd need to add a few additional comments to this section explaining the rationale behind Banker's rounding and why it exists. It may also be worth showing folx how to round in different ways.

Describe "Banker's Rounding" {
It 'rounds to nearest even number on .5' {
# Try and guess how PowerShell will round these numbers
____ | Should -Be ([int]2.5)
____ | Should -Be ([int]3.34)
____ | Should -Be ([int]10.61)
____ | Should -Be ([int]12.7)
____ | Should -Be ([int]5.5)
}
}

Context "Additional Information"

https://twitter.com/jschpp/status/1221810270210809858

@vexx32 vexx32 added Issue-Suggestion This should be added! Category-Koans Invoking the Great Doubt labels Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Koans Invoking the Great Doubt Issue-Suggestion This should be added!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant