bits, data types, and operations: chapter 2
DESCRIPTION
1. Bits, Data types, and Operations: Chapter 2. COMP 2610. Dr. James Money COMP 2610. Floating Point Data Type. Most ISAs have a data type called float , which is 32 bits arranged as follows 1 bit for sign 8 bits for range of exponent 23 bits for the precision or fraction - PowerPoint PPT PresentationTRANSCRIPT
Bits, Data types, and Operations: Chapter 2
COMP 2610Dr. James Money
COMP 2610
1
Floating Point Data Type
Most ISAs have a data type called float, which
is 32 bits arranged as follows– 1 bit for sign
– 8 bits for range of exponent
– 23 bits for the precision or fraction
This is called the IEEE Standard for Floating
Point Arithmetic
Floating Point Data Type
Floating Point Data Type
Recall the bits in the fractional part are of the
form
1.b-1b-2…b-j
The corresponding decimal number is
1x20 + b-1x2-1+b-2x2-2+… + b-j 2-j
Floating Point Data Type
If the exponent=00000000, then we can
represent tiny numbers.
In this case, we assume the leading digit is
zero and not 1 and exp=-126. That is, it is of
the form
-1s 0.fraction x 2-126
Floating Point Data Type
Consider the floating point value
0 00000000 0000100000000000000000
This is
+ 2-5 x 2-126 = 2-131
Floating Point Data Type
Interpret the floating point values
– 0 11111110 1111111111111111111111
– 1 00001101 0111000000000000000000
– 1 00000000 0000000000001000000000
ASCII Codes
Another standard of representation is one for
transferring character codes
This is an eight bit code referred to ASCII
ASCII stands for American Standard Code for
Information Exchange
It simplifies the interface between I/O devices
among companies
ASCII Codes
Each key on a keyboard is identified by a
unique ASCII code
The digit 3 is (00110011)2 = (41)10, digit 3 is
(00110010)2 = (40)10
The letter ‘e’ is (01100101)2 and carriage
return is (00001101)2
ASCII Codes
The list of codes are at the back of the book
for all 256 ASCII codes
Some codes are associate with multiple
keys, such as ‘e’ and ‘E’
Hexadecimal Notation
One form that is common for reading values
on the computer is called hexadecimal
notation
Hexadecimal notation is the base 16
representation of the number
Hexadecimal Notation
We use 0-9 for the same numbers in
hexadecimal
What about 10-15?
We use the letters A-F
Hexadecimal Notation
A – 10
B – 11
C – 12
D – 13
E – 14
F - 15
Hexadecimal Notation
Consider the binary string
0011110101101110
This can be broken into groups of 4 bits:
0011 1101 0110 1110
Now, recall that the range of 4 bits is 0 -15,
just like hexadecimal notation
Hexadecimal Notation
Hence, the numbers represent
We typically prefix this by x or 0x to indicate
hexadecimal form
So our binary number is 0x3D6E
0011 1101 0110 1110
3 13 6 14
3 D 6 E
Hexadecimal Notation
What is the number 0x5A6C in binary form?
Thus, (5A6C)16 = (0101 1010 0110 1100)2
5 A 6 C
5 10 6 12
0101 1010 0110 1100