1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

34
1 1 0 0 0 1 0 0 0 1 0 0 1 1 1 1

Post on 20-Dec-2015

274 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 11 1 1 1 1 1 1 1

Page 2: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

• A text code is a system that uses binary numbers (1s and 0s) to represent characters understood by humans (letters and numerals).

• An early text code system, called EBCDIC, uses eight-

bit codes, but is used primarily in older mainframe systems.

• In the most common text-code set, ASCII, each character consists of eight bits (one byte) of data. ASCII is used in nearly all personal computers.

• In the Unicode text-code set, each character consists of 16 bits (two bytes) of data.

How Computers Represent Data - Text Codes

Page 3: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

CodeCode CharacterCharacter

0011000000110000 00

0011000100110001 11

0011001000110010 22

0011001100110011 33

0011010000110100 44

0011010100110101 55

0100000101000001 AA

0100001001000010 BB

0100001101000011 CC

0100010001000100 DD

0100010101000101 EE

Examples from theASCII Text Code

Text Codes

Page 4: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Goal: Representing Numbers in Goal: Representing Numbers in BinaryBinary

Base 10 (Base 10 (decimaldecimal) - Numbers are represented using 10 ) - Numbers are represented using 10 numerals: 0, 1, 2, 3 … 9numerals: 0, 1, 2, 3 … 9

Base 2 (Base 2 (binarybinary) - Numbers are represented using 2 numerals: ) - Numbers are represented using 2 numerals: 0, 10, 1

Base 10 - Each position represents a power of 10: Base 10 - Each position represents a power of 10:

110011 = = 11*10*1022 + + 00*10*1011 + + 11*10*1000 = 100 + 1 = 100 + 1111100 = = 11*10*1022 + + 11*10*1011 + + 00*10*1000 = 100 + 10 = 100 + 10

Base 2 - Each position represents a power of 2: Base 2 - Each position represents a power of 2: 110011bb = = 11*2*222 + +

00*2*211 + + 11*2*200 = 100 = 100bb + 1 + 1bb = 4 + 1 = 4 + 1

111100bb = = 11*2*222 + + 11*2*211 + + 00*2*200 = 100 = 100bb + 10 + 10bb = 4+2 = 4+2

Page 5: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Numbers in base 10 are called Numbers in base 10 are called decimal decimal numbers,numbers,they are composed of 10 numerals. they are composed of 10 numerals. dd33dd22dd11dd00 = d = d33*10*103 3 ++ dd22*10*102 2 ++ dd11*10*101 1 ++ dd00*10*1000

9786 = 9*1000 + 7*100 + 8*10 + 6*1 9786 = 9*1000 + 7*100 + 8*10 + 6*1 = 9*10 = 9*1033 + 7*10 + 7*1022 + 8*10 + 8*1011 + 6*10 + 6*1000

Numbers in base 2 are called Numbers in base 2 are called binarybinary numbers, they are composed of numbers, they are composed of the numerals 0 and 1.the numerals 0 and 1. b b33bb22bb11bb00 = b = b33*2*23 3 ++ bb22*2*22 2 ++ bb11*2*21 1 ++ bb00*2*20 0

110101 = 1*32 + 1*16 + 0*8 + 1*4 + 0*2 + 1*1 110101 = 1*32 + 1*16 + 0*8 + 1*4 + 0*2 + 1*1 = 1*2 = 1*255 + 1*2 + 1*244 + 0*2 + 0*233 + 1*2 + 1*222 + 0*2 + 0*211 + 1*2 + 1*200

1111 1111 1111 1111 = 32768 + 16384 + 8192 + 4096 + 1111 1111 1111 1111 = 32768 + 16384 + 8192 + 4096 + 2048 + 1024 + 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 22048 + 1024 + 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 21515 + 2 + 21414 + … + + … + 2211 + 2 + 200 = =

22nn = 2 = 2n+1 n+1 - 1 =- 1 = 221616 -1 -1

Page 6: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Converting from Binary to DecimalConverting from Binary to Decimal

Easy: Multiply each numeral by its exponent. Easy: Multiply each numeral by its exponent. 11000011bb = = 11*2*23 3 + + 11*2*200 = = 11*8 + *8 + 11*1 = 9*1 = 9dd

00111111bb = = 00*2*233 + + 11*2*222 + + 11*2*211 + + 11*2*200

= 100 = 100bb + 10 + 10bb + 1 + 1bb

= 4 + 2 + 1 = 4 + 2 + 1 = 7 = 7

111100111100bb = = 11*2*255 + + 11*2*244 + + 00*2*233 + + 11*2*22 2 + + 11*2*21 1

= 100000 = 100000bb + 10000 + 10000bb + 100 + 100bb + 10 + 10bb

= 32 + 16 + 4 + 2 = 32 + 16 + 4 + 2

= 54 = 54

Page 7: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Given an array that holds a 32 digit binary number called Given an array that holds a 32 digit binary number called binary:binary:

int[] binary = {1, 0, 0, 1};int[] binary = {1, 0, 0, 1};int decimal = 0;int decimal = 0;for(int i=binary.length-1;i>=0;i--)for(int i=binary.length-1;i>=0;i--)

decimal += binary[i]*Math.pow(2,i);decimal += binary[i]*Math.pow(2,i);

The powers of 2: The powers of 2: 2200 = 1 = 1 2211 = 2 = 2 2222 = 4 = 4 2233 = 8 = 82244 = 16 = 16 2255 = 32 = 32 2266 = 64 = 64 2277 = 128 = 128 2288 = 256 = 256 2299 = 512 = 512 221010 = 1024 = = 1024 = 1K1K221111 = 2048 = 2048 221212 = 4096 = 4096 221313 = 8192 = 8192

221616 = 65536 = 65536 222020 = 1048576 = = 1048576 = 1M1M

Converting from Binary to DecimalConverting from Binary to Decimal

Page 8: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Converting From Decimal to Converting From Decimal to BinaryBinary

In Java it looks like this:In Java it looks like this:int decimal = readInt();int decimal = readInt();int res;int res;int power;int power;for(int n=31; n>=0; n--){for(int n=31; n>=0; n--){ power = (int)Math.pow(2,n);power = (int)Math.pow(2,n); res = decimal/power;res = decimal/power; decimal = decimal - res*power;decimal = decimal - res*power; System.out.print(res);System.out.print(res);}}

Page 9: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

A Base Conversion ExampleA Base Conversion Example

500/2500/299 = 0 ; 500 - 0 = 500 = 0 ; 500 - 0 = 500 4/24/233 = 0 ; 4 - 0 = 4 = 0 ; 4 - 0 = 4

500/2500/288 = 1 ; 500 - 256 = 244 4/2 = 1 ; 500 - 256 = 244 4/222 = 1 ; 4 - 4 = 0 = 1 ; 4 - 4 = 0

244/2244/277 = 1 ; 244 - 128 = 116 0/2 = 1 ; 244 - 128 = 116 0/211 = 0 ; 0 - 0 = 0 = 0 ; 0 - 0 = 0

116/2116/266 = 1 ; 116 - 64 = 52 0/2 = 1 ; 116 - 64 = 52 0/200 = 0 ; 0 - 0 = 0 = 0 ; 0 - 0 = 0

52/252/255 = 1 ; 52 - 32 = 20 = 1 ; 52 - 32 = 20

20/220/244 = 1 ; 20 - 16 = 4 = 1 ; 20 - 16 = 4

500500dd = 111110100 = 111110100bb

Page 10: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Representation Representation of Numbersof Numbers

int, long, short, char - positive numbers are stored as a int, long, short, char - positive numbers are stored as a binary number where the MSB (binary number where the MSB (Most Significant BitMost Significant Bit) is 0) is 0A A shortshort is represented by 16 bits (2 bytes) is represented by 16 bits (2 bytes) 100d = 2100d = 266 + 2 + 255 + 2 + 222 = =

00000000011001000000000001100100An An intint is represented by 32 bits (4 bytes) is represented by 32 bits (4 bytes)6554565545dd = 2 = 21616 + 2 + 233 + 2 + 20 = 0 =

0000000000000001000000000000100100000000000000010000000000001001 A A charchar is represented by 16 bits is represented by 16 bits (2 bytes)(2 bytes)

‘0’ = 48d = 2‘0’ = 48d = 255 + 2 + 244 = =0000000000000000 0011000000110000

Page 11: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Signed and Unsigned NumbersSigned and Unsigned Numbers

How do we distinguish How do we distinguish between them? between them? Solution:Solution: Use 1 bit to represents the sign. The name of Use 1 bit to represents the sign. The name of

this scheme is called:this scheme is called:sign and magnitudesign and magnitude 1100011110001111bb = = --15 15 0000011110001111bb = = ++15 15 (8 bit numbers)(8 bit numbers)

There are several problems with this scheme:There are several problems with this scheme:• where do we put the sign?where do we put the sign?• an extra step is needed to calculate the sign bitan extra step is needed to calculate the sign bit

– Add the Add the magnitudemagnitudes.s.– Calculate the Calculate the signsign..

• there is both a positive and negative zerothere is both a positive and negative zero 1100000000000000bb = = --0 0 0000000000000000bb = = ++0 0

Page 12: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Two's ComplementTwo's Complement

New Solution:New Solution: Leading 0s mean positive and leading 1s Leading 0s mean positive and leading 1s mean negative.mean negative.0111111101111111bb >> 0 10000000 0 10000000bb << 0 0 (8 bit numbers)(8 bit numbers)

The largest positive number is:The largest positive number is: 2,147,483,647 2,147,483,647dd (2(23131 -1) = 01111…11111 -1) = 01111…11111bb

The smallest negative number is:The smallest negative number is: -2,147,483,648 -2,147,483,648dd (-2 (-23131) = 10000…00000) = 10000…00000bb

It is followed by -2,147,483,647It is followed by -2,147,483,647dd (1000…0001 (1000…0001bb) up to -1 ) up to -1 (1111…1111(1111…1111bb).).

The sum of a number and its inverse is 100...0, where 1 The sum of a number and its inverse is 100...0, where 1 is an overflow and is thrown away.is an overflow and is thrown away.

Page 13: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Two’s ComplementTwo’s Complement

+3 = 00000011+3 = 00000011 +2 = 00000010+2 = 00000010 +1 = 00000001+1 = 00000001 +0 = 00000000+0 = 00000000 -1 = 11111111-1 = 11111111 -2 = 11111110-2 = 11111110 -3 = 11111101-3 = 11111101

Page 14: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

BenefitsBenefits

One representation of zeroOne representation of zero Arithmetic works easily (see later)Arithmetic works easily (see later) Negating is fairly easyNegating is fairly easy

• 3 = 000000113 = 00000011

• Boolean complement givesBoolean complement gives 1111110011111100

• Add 1 to LSBAdd 1 to LSB 1111110111111101

Page 15: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Geometric Depiction of Twos Geometric Depiction of Twos Complement IntegersComplement Integers

Page 16: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Negative Decimal to BinaryNegative Decimal to Binary

Translate the number to binary.Translate the number to binary. Flip the bits (1 -> 0, 0 -> 1)Flip the bits (1 -> 0, 0 -> 1) Add 1Add 1

-100-100dd = -01100100 = 10011011 + 1 = 10011100 = -01100100 = 10011011 + 1 = 10011100 -1 -1d d == -- 00000001 = 11111110 + 1 = 1111111100000001 = 11111110 + 1 = 11111111bb

-128-128dd = -10000000 = 01111111 + 1 = -10000000 = 01111111 + 1 = 10000000= 10000000bb

1100010111000101bb = 00111010 + 1 = 00111011 = -59 = 00111010 + 1 = 00111011 = -59dd

In a short:In a short:-25,000-25,000dd = -0110000110101000 = 1001111001010111 + 1 = = -0110000110101000 = 1001111001010111 + 1 = 1001111001100010011110011000bb

Page 17: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Conversion Between LengthsConversion Between Lengths

Positive numbers pack with leading zerosPositive numbers pack with leading zeros +18 = 00010010+18 = 00010010 +18 = 00000000 00010010+18 = 00000000 00010010 Negative numbers pack with leading onesNegative numbers pack with leading ones -18 = 10010010-18 = 10010010 -18 = 11111111 10010010-18 = 11111111 10010010 i.e. pack with MSB (sign bit)i.e. pack with MSB (sign bit)

Page 18: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Hexadecimal NumbersHexadecimal Numbers

Numbers in base 16 are called Numbers in base 16 are called hexadecimalhexadecimal numbers,numbers, they are composed of 16 numerals they are composed of 16 numerals (0-9,a-f).(0-9,a-f).99778866hexhex = = 99*16*1633 + + 77*16*1622 + + 88*16*1611 + + 66*16*160 0 == = = 99*4096 + *4096 + 77*256 + *256 + 88*16 + *16 + 66*1 = 38790*1 = 38790dd

0x0xaabbccddeeff = = 1010*16*1655 + + 1111*16*1644 + + 1212*16*1633 + + 1313*16*162 + 2 +

1414*16*1611 + + 1515*16*160 0 == 1125937511259375dd

The conversion from binary to hex is very easy, each hex digit is 4 The conversion from binary to hex is very easy, each hex digit is 4 binary digits:binary digits:0x0 = 0000 0x1 = 0001 0x2 = 0010 0x3 = 00110x0 = 0000 0x1 = 0001 0x2 = 0010 0x3 = 00110x4 = 0100 0x5 = 0101 0x6 = 0110 0x7 = 01110x4 = 0100 0x5 = 0101 0x6 = 0110 0x7 = 01110x8 = 1000 0x9 = 1001 0xa = 1010 0xb = 10110x8 = 1000 0x9 = 1001 0xa = 1010 0xb = 10110xc = 1100 0xd = 1101 0xe = 1110 0xf = 11110xc = 1100 0xd = 1101 0xe = 1110 0xf = 1111

Page 19: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Binary <-> HexadecimalBinary <-> Hexadecimal

Using the previous table it is easy to represent 32 bit Using the previous table it is easy to represent 32 bit binary numbers in a short form:binary numbers in a short form:0100 1010 0010 1101 1000 1100 0111 1001 =0100 1010 0010 1101 1000 1100 0111 1001 = 4 a 2 d 8 c 7 9 = 4 a 2 d 8 c 7 9 =0x4a2d8c79.0x4a2d8c79.

0x12390ab4 =0x12390ab4 =0001 0010 0011 1001 0000 1010 1011 01000001 0010 0011 1001 0000 1010 1011 0100 1 2 3 9 0 a b 4 1 2 3 9 0 a b 4

0xffffffff =0xffffffff =1111 1111 1111 1111 1111 1111 1111 11111111 1111 1111 1111 1111 1111 1111 1111

Every 2 Hex digits are a byteEvery 2 Hex digits are a byte

Page 20: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Conversion from decimal to hexadecimal is similar to Conversion from decimal to hexadecimal is similar to converting decimal to binary.converting decimal to binary.

int decimal=readInt();int decimal=readInt();int res;int res;int power;int power;for(int n=7;n>=0;n--){for(int n=7;n>=0;n--){

power = (int)Math.pow(16,n);power = (int)Math.pow(16,n); res = decimal/power;res = decimal/power; decimal = decimal - res*power;decimal = decimal - res*power;

if(res>9) if(res>9) System.out.print((char)((res - 10) + 'a')); System.out.print((char)((res - 10) + 'a'));

else else System.out.print(res);System.out.print(res);}}

Decimal -> HexadecimalDecimal -> Hexadecimal

Page 21: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Java allows numbers in octal (start with 0) and Java allows numbers in octal (start with 0) and hexadecimal (start with 0x or 0X).hexadecimal (start with 0x or 0X).

int num1 = 015;int num1 = 015;

int num2 = 0x1a;int num2 = 0x1a;

num1 is 13num1 is 13

num2 is 26num2 is 26

Octal & Hex in JavaOctal & Hex in Java

Page 22: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

AdditionAddition

Lets add 6 to 7:Lets add 6 to 7:00…00111 = 700…00111 = 7dd

00…00110 = 600…00110 = 6dd

00…01101 = 1300…01101 = 13dd Lets add 11 to 5:Lets add 11 to 5:

00…01011 = 1100…01011 = 11dd

00…00101 = 500…00101 = 5dd

00…10000 = 1600…10000 = 16dd

1

0

(0) 1

1

1

(1) 0

(0)

1

1

(1) 1

(1)

0

0

(0) 1

(1)

0

0

(0) 0

(0)

0

0

(0) 0

(0) (Carries)

97108/Patterson Fig 4.03

Page 23: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

SubstractionSubstraction

Subtraction uses addition, the operand is simply Subtraction uses addition, the operand is simply negated before being added:negated before being added:7 - 6 = 7 + (-6) =7 - 6 = 7 + (-6) =00…00111 = 700…00111 = 7dd

11…11010 = -611…11010 = -6dd 00…00001 = 100…00001 = 1dd

Page 24: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Overflow Overflow

Overflow Overflow occurs when the result of a operation can't be represented by the occurs when the result of a operation can't be represented by the hardware. This can happen when we add two numbers of the same sign hardware. This can happen when we add two numbers of the same sign or subtract two large numbers of opposing signs.or subtract two large numbers of opposing signs.

Overflow is detected by the following table:Overflow is detected by the following table:OperationOperation A A B B Result Result A+BA+B >=0 >=0 <0 >=0 >=0 <0 A+B A+B <0 <0 >=0 <0 <0 >=0 A- B A- B >=0 <0 <0 >=0 <0 <0 A- B A- B <0 >=0 >=0 <0 >=0 >=0

Page 25: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

MultiplicationMultiplication

Look at the following pencil and paper example:Look at the following pencil and paper example:10001000dd

XX 10011001dd10001000

0000 0000 0000 0000 1000 1000 1001000 1001000dd

By restricting the digits to 1 & 0 (which is binary) the By restricting the digits to 1 & 0 (which is binary) the algorithm is simple, at each step:algorithm is simple, at each step:• Place a copy of the multiplicand Place a copy of the multiplicand if the multiplier digit is 1.if the multiplier digit is 1.• Place 0 if the digit is 0.Place 0 if the digit is 0.• The position for the next step is shifted left by one place.The position for the next step is shifted left by one place.

Page 26: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Real NumbersReal Numbers

Numbers with fractionsNumbers with fractions Could be done in pure binaryCould be done in pure binary

• 1001.1010 = 21001.1010 = 244 + 2 + 200 +2 +2-1-1 + 2 + 2-3 -3 =9.625=9.625

Where is the binary point?Where is the binary point? Fixed?Fixed?

• Very limitedVery limited

Moving?Moving?• How do you show where it is?How do you show where it is?

Page 27: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Floating PointFloating Point

+/- .significand x 2+/- .significand x 2exponentexponent

Point is actually fixed between sign bit and body of Point is actually fixed between sign bit and body of mantissamantissa

Exponent indicates place value (point position)Exponent indicates place value (point position)

Sig

n bi

t

BiasedExponent

Significand or Mantissa

Page 28: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Signs for Floating PointSigns for Floating Point

Mantissa is stored in 2s complimentMantissa is stored in 2s compliment Exponent is in excess or biased notationExponent is in excess or biased notation

• e.g. Excess (bias) 128 meanse.g. Excess (bias) 128 means

• 8 bit exponent field8 bit exponent field

• Pure value range 0-255Pure value range 0-255

• Subtract 128 to get correct valueSubtract 128 to get correct value

• Range -128 to +127Range -128 to +127

Page 29: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

NormalizationNormalization

FP numbers are usually normalizedFP numbers are usually normalized i.e. exponent is adjusted so that leading bit (MSB) of i.e. exponent is adjusted so that leading bit (MSB) of

mantissa is 1mantissa is 1 Since it is always 1 there is no need to store itSince it is always 1 there is no need to store it (c.f. Scientific notation where numbers are normalized (c.f. Scientific notation where numbers are normalized

to give a single digit before the decimal pointto give a single digit before the decimal point e.g. 3.123 x 10e.g. 3.123 x 1033))

Page 30: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Floating Point ExamplesFloating Point Examples

XXXXXXXX

Page 31: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

Expressible NumbersExpressible Numbers

Page 32: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

IEEE 754IEEE 754

Standard for floating point storageStandard for floating point storage 32 and 64 bit standards32 and 64 bit standards 8 and 11 bit exponent respectively8 and 11 bit exponent respectively Extended formats (both mantissa and exponent) for Extended formats (both mantissa and exponent) for

intermediate resultsintermediate results

Page 33: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

FP Arithmetic +/-FP Arithmetic +/-

Check for zerosCheck for zeros Align significands (adjusting exponents)Align significands (adjusting exponents) Add or subtract significandsAdd or subtract significands Normalize resultNormalize result

Page 34: 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 1 1 1 1 1

FP Arithmetic FP Arithmetic x/x/

Check for zeroCheck for zero Add/subtract exponents Add/subtract exponents Multiply/divide significands (watch sign)Multiply/divide significands (watch sign) NormalizeNormalize RoundRound All intermediate results should be in double length All intermediate results should be in double length

storagestorage