Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)

Similar presentations


Presentation on theme: "Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)"— Presentation transcript:

1 Chapter 2 Bits, Data Types, and Operations

2 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16) numbers instead. fewer digits -- four bits per hex digit less error prone -- easy to corrupt long string of 1’s and 0’s BinaryHexDecimal 000000 000111 001022 001133 010044 010155 011066 011177 BinaryHexDecimal 100088 100199 1010A10 1011B11 1100C12 1101D13 1110E14 1111F15

3 2-3 Convert Hexadecimal (2’s C binary) to Decimal Given a hex digit that represents 2’s complement binary, convert into a decimal. Example: 6F hex or x6F 1.Determine the sign of the number. If the msh (most significant hex) value is 8 or greater then the sign is negative. 6F hex, sign + b/c msh (6) < 8 sign positive 2.Use positional notation to convert 6x16 1 + Fx16 0 = 6x16 1 + 15 = 96 + 15 = 111 6F hex = 111 ten

4 2-4 Convert Hexadecimal (2’s C binary) to Decimal Given a hex digit that represents 2’s complement binary, convert into a decimal. Example: A0F hex or xA0F 1.Determine the sign of the number. If the msh (most significant hex) value is 8 or greater then the sign is negative. A0F hex, sign - b/c msh (A) < 8 sign negative 2.Since negative, must apply 2’s complement 3.Convert to signed magnitude to decimal with positional notation -(5x16 2 + Fx16 1 + 1x16 0 ) = -(5x256 + 15x16 + 1) = -1,521 FFF - A0F 5F0 5F0 + 1 5F1 A0F = - 5F1


Download ppt "Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)"

Similar presentations


Ads by Google