-
-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Labels
Category-KoansInvoking the Great DoubtInvoking the Great DoubtIssue-DiscussionLet's talk about it!Let's talk about it!
Description
Describe "Koan Bug, Issue, or Help Request"
AboutBitwiseOperations
Context "The Problematic Assertions"
The following two statements seem to contradict themselves (it is late here and I am studying, so I will revisit this in the morning again, but I think we have an error in description for LEAST/MOST:
It 'A byte is made up of 8 bits' {
<#
Each bit can be set to either 0 or and each has a value based
on its position.
The most significant bit, the largest value, is first. The least
significant bit, the smallest value, is last.
Bit position Value
------------ -----
1 128
2 64
3 32
4 16
5 8
6 4
7 2
8 1
This order is known as Big Endian.
#>
'00000001' | ConvertFrom-Binary | Should -Be 1 # Least significant
'00000010' | ConvertFrom-Binary | Should -Be 2
'00000100' | ConvertFrom-Binary | Should -Be 4
'00001000' | ConvertFrom-Binary | Should -Be 8
'00010000' | ConvertFrom-Binary | Should -Be 16
'00100000' | ConvertFrom-Binary | Should -Be 32
'01000000' | ConvertFrom-Binary | Should -Be 64
'10000000' | ConvertFrom-Binary | Should -Be 128 # Most significant
}
and
It 'a binary string can be used to represent different numeric values' {
# The number it represents can depend on the numeric type used.
$BinaryValue = '11100001'
$BinaryValue | ConvertFrom-Binary -To Byte | Should -Be 225
$BinaryValue | ConvertFrom-Binary -To SByte | Should -Be -31
<#
As the signing bit is always the least significant, converting the 8 bit
binary value above to a larger type, such as, Int32 will create a positive value.
#>
$BinaryValue | ConvertFrom-Binary -To Int32 | Should -Be 225
}I think this should read As the signing bit is always the most significant...
Context "Your Attempts"
an attempt at understanding late at night.
Context "Additional Information"
the moon illuminates a path
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Category-KoansInvoking the Great DoubtInvoking the Great DoubtIssue-DiscussionLet's talk about it!Let's talk about it!