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

AboutBitwiseOperations - Error in description? #466

Open
DEberhardt opened this issue Jan 29, 2022 · 1 comment
Open

AboutBitwiseOperations - Error in description? #466

DEberhardt opened this issue Jan 29, 2022 · 1 comment
Labels
Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it!

Comments

@DEberhardt
Copy link
Contributor

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

@DEberhardt DEberhardt added Category-Koans Invoking the Great Doubt Issue-Discussion Let's talk about it! labels Jan 29, 2022
@indented-automation
Copy link
Contributor

Huh, yes... will fix. Thanks!

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-Discussion Let's talk about it!
Projects
None yet
Development

No branches or pull requests

2 participants