Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review Binary Basic Conversion Binary1286432168421Decimal 7 0110 001001100010 38 1101 000111010001 129 1010 10101010 182 0000 111100001111 255.

Similar presentations


Presentation on theme: "Review Binary Basic Conversion Binary1286432168421Decimal 7 0110 001001100010 38 1101 000111010001 129 1010 10101010 182 0000 111100001111 255."— Presentation transcript:

1 Review Binary Basic Conversion Binary1286432168421Decimal 7 0110 001001100010 38 1101 000111010001 129 1010 10101010 182 0000 111100001111 255

2 Review Binary Conversion of decimals 21..5.25.125.0625.03125 Decimal 11.1000111.10001.2.0625 00.0110000.01100.1.53125 10.0001110.00011.0.875

3 Review Binary Conversion of non-standard decimals ◦Note: Remember to convert the whole number separately NumberWhole Number Part number 0.22x 2 = NumberWhole Number Part number 1.15x 2 = Solution:

4 Binary 2 NEGATIVE NUMBERS

5 bits Each 0 or 1 is a bit of information Bit = binary digit A bit is a single piece of information A nibble is 4 bits of information A byte is 8 bits of information A word refers to a string of bits used is a process by a computer. Eg. A computer might work in 8, 16 or 32 bit words.

6 bits When we talk about representing a number using 5 bits, it means we have five 0’s and 1’s 01001 (9) In binary we’ll typically work with 8 bits 0100 0001 (65) As they are strings of bits, we might refer to any of these as a ‘word’ ◦A 5-bit word ◦An 8-bit word

7 bits In representing a number there are bits that are sometimes referred to as: ◦Most Significant bit ◦Least Significant bit Most significant bit ◦Left most bit ◦In the position for the largest value number Least significant bit ◦Right most bit ◦In the position for the lowest value number 10001 Most significant bit – value 16 Least significant bit – value 1

8 What about negative numbers? How might we represent negative numbers using only 0s and 1s? Let’s consider... ◦Unsigned Binary ◦Sign & Magnitude ◦Two’s Complement

9 Unsigned Binary This is binary in the format we have already dealt with ◦Deals with positive numbers only ◦No extra bits

10 Sign and Magnitude Sometimes referred to as signed binary Deals with positive and negative numbers Reserves a bit (the most significant bit) as a ‘sign bit’ Sign bit is used to indicate a positive number (0) or a negative number (1) 0 101 is + 5 (positive) 1 101 is - 5 (negative)

11 Sign and Magnitude Using Sign and Magnitude (with 1 sign bit, and 7 bits for the number), convert the following numbers BinaryDecimal 0 000 1011 1 000 1100 10 -65 -18 1 111 0010 85

12 Sign and Magnitude Using Sign and Magnitude, convert the following numbers BinaryDecimal 0 000 101111 1 000 1100-12 0 000 101010 1 100 0001-65 1 001 0010-18 1 111 0010-114 0 101 010185

13 Two’s Complement Two’s complement is also used to represent positive and negative numbers. It does not use a sign bit, however the most significant bit does act as an indicator for the sign of the number The two’s complement of a number is the negative representation of a number

14 Two’s Complement ‘Taking a two’s complement’ means getting the negative representation of a number The easiest way to do this: ◦Start with the positive representation of the number ◦Start from the right most bit and work towards the left ◦Any ‘0’ bits remain the same until the first ‘1’ bit ◦Keep the first ‘1’ bit as a 1 ◦Change every other bit to its opposite (1  0 and 0  1)

15 Two’s Complement – Start with the positive representation of the number – Start from the right most bit and work towards the left – Any ‘0’ bits remain the same until the first ‘1’ bit – Keep the first ‘1’ bit as a 1 – Change every other bit to its opposite (1  0 and 0  1) 6 is 0000 0110 0000 0110  1111 1010 

16 Two’s complement Follow the steps to determine the 8-bit two’s complement representation of -5 and -10 OriginalBinary Representation Two’s ComplementNew Value 5 10

17 Two’s complement Follow the steps to determine the 8-bity two’s complement representation of -5 and -10 OriginalBinary Representation Two’s ComplementNew Value 50000 01011111 1011-5 100000 10101111 0110-10

18 Two’s Complement Important Note!!! You only need to ‘take the two’s complement’ if ◦the number is negative, or ◦the number needs to be subtracted Always start with more bits than you require to represent the number. ◦Eg. 4 can be represented using just 3 bits, to complete two’s complete accurately you must work with at least 4 bits or more


Download ppt "Review Binary Basic Conversion Binary1286432168421Decimal 7 0110 001001100010 38 1101 000111010001 129 1010 10101010 182 0000 111100001111 255."

Similar presentations


Ads by Google