Binary Numbers and Integer Representations Flashcards
Binary Number Features
Are base 2 numbers / Use binary digits (bits) 0 and 1 / Easy to encode on a computer, since only 2 states need to be distinguished / Binary numbers are encoded using 1 or more bits in combination
How many bit patterns can be held by an N-bit register
2^N (e.g. 4bit register can hold 16 distinct bit patterns)
How are unsigned integers encoded?
Using binary numbers
What is the range for binary numbers
0 to 2^N -1
How are signed integers encoded?
Using two’s complement representation
What is the range for two’s complement representation?
-2^(N-1) to +2^(N-1)-1
How can a number be negated (2’s complement)
Take the one’s complement 0(Reverse 0s and 1s) / Add 1 to the result
All positive numbers have a _ in the sign-bit (left-most bit)
0
All negative numbers have a _ in the sign-bit (left-most bit)
1
Are sign-magnitude and one’s complement representations possible?
Yes but they are awkward to handle in hardware, have two 0s (-0 and +0)
Hexadecimal conversion table (base 16)
Screenshot
What is the prefix for Hex. #s?
0x
What are Octal numbers used for?
They are used as a shorthand for denoting bit patterns / Each digit corresponds to a 3-bit pattern e.g. 0756
What is the prefix for Oct #s
0
Linux on ARMv8 in AArch64 uses the ____ data model
LP64 (long integers and pointers are 64-bits long)