Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC
-
Upload
colorado-lancaster -
Category
Documents
-
view
30 -
download
1
description
Transcript of Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC
![Page 1: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/1.jpg)
Monday, October 4
Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETICAssignment #6: DEBUG EXERCISES
Quiz(zes) due: Quiz #5: Base ArithmeticQuiz #6 (Complement Arithmetic)
Note: Quiz #7 (Debug) will be due next Monday
Emulator Progress Worksheet 1 will be due next Monday
Today is the cutoff date for all Simple Computer labs and assignments
And next Monday is the cutoff date for all arithmetic assignments and quizzes(Assignment #5, Quiz #5, Quiz #6, Optional Quizzes #5, #7 and #8)
Please note: The date of the midterm is Monday, October 18- an 8.5 in. * 11 in. cheat sheet will be allowed
We will review for the midterm next week
I recommend going over the midterm practice exercises before I discuss them on Monday
Don't forget the optional quiz: Debug
![Page 2: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/2.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI
![Page 3: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/3.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI
But first:
What does this mean? 120 121 122 123
![Page 4: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/4.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI
But first:
What does this mean? 120 121 122 123 34 12 00 01
![Page 5: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/5.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI ? 0120 ?
![Page 6: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/6.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI ? 0120 ? ? 0120 0002
![Page 7: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/7.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI ? 0120 ? ? 0120 00021234 0120 0002
![Page 8: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/8.jpg)
Given the following information in DEBUG:
-e 120 34 12 00 01
-u 100, 10A21F0:0100 BB2001 MOV BX, 12021F0:0103 BE0200 MOV SI, 221F0:0106 0307 MOV AX, [BX]21F0:0108 0300 ADD AX, [BX + SI]
Trace through the partial program above, showing the contents of the AX, BX and SI registers
AX BX SI ? 0120 ? ? 0120 00021234 0120 00021334 0120 0002
![Page 9: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/9.jpg)
Review:
MOV CX ,0003MOV AX, 0000ADD AX, CX
LOOP 106
INT 20
Using the LOOP instruction (works with CX):
How does the loop instruction work?
![Page 10: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/10.jpg)
Review:
MOV CX ,0003MOV AX, 0000ADD AX, CX
LOOP 106
INT 20
Using the LOOP instruction (works with CX):
How does the loop instruction work?
1. It decrements CX
2. It checks CX (is CX > 0?)
3. If CX > 0- it loops to the address specified
If CX = 0- it goes to the next instruction in sequence
![Page 11: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/11.jpg)
- each location in the computer is assigned a unique address
- memory locations- input/output devices
- the address allows them to be recognized by the CPU
- the CPU puts the address on the address bus - identified by the decoding circuits
- the data bus is used to get data to or from the address
- the control bus sends read/write signals- to indicate if the CPU is asking for or sending information
- every process in the computer (at every level of the computer)- uses this fetch/decode/execute cycle
![Page 12: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/12.jpg)
- each location in the computer is assigned a unique address
- memory locations
- input/output devices
- the address allows them to be recognized by the CPU
- the CPU puts the address on the address bus
- identified by the decoding circuits
- the data bus is used to get data to or from the address
- the control bus sends read/write signals
- to indicate if the CPU is asking for or sending information
CPU
(ALU,registers,controlunit)
RAM ROM Printer cd/dvd Monitor Keyboard Mouse
Address Bus
Data Bus
Control Bus
![Page 13: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/13.jpg)
- the function (or purpose) of the CPU:- to fetch and execute instructions
- more efficient if the process is divided
- at the same time:- one instruction is being executed, and- the next instruction is being fetched
- implemented by theoretically dividing the CPU into:
- the execution unit- decodes and executes instructions
and- the bus interface unit
- fetches the instructions
![Page 14: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/14.jpg)
- the execution unit contains- the ALU
- performs operations- arithmetic- logical
- registers- high speed memory- temporarily store data or addresses
- general purpose registers- available to programmers
- special purpose registers- e.g. the instruction pointer, the instruction register- not available to programmers- to indicate if the CPU is asking for or sending information
- the flags register- is set (or reset) as the result of operations done in the ALU- can be checked by a program
- the decoder- determines the type of instruction- interprets it into a form that can be used in the ALU and registers
![Page 15: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/15.jpg)
- the bus interface unit- where instructions and data come in from main memory
- the bus interface unit delivers them to the execution unit
- contains:- the instruction queue
- allows the bus interface unit to stay ahead of the execution unit- when the queue is full
- the buses are idle- if the program performs a jump
- the queue will be changed
- the instruction pointer- holds the address of the next instruction to be executed
- the address will be placed on the address bus
- the segment registers- hold the addresses of the various parts of memory used by the program
- where the instructions are stored- where the data is stored- where the program’s stack is located
- the execution unit and the bus interface unit work in parallel- but the bus interface unit is always at least one step ahead
![Page 16: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/16.jpg)
Registers:
General
- EAX (accumulator)
EAX - 32 bits
8 hexadecimal digits
AX - 16 Bits
4 hexadecimal digits
AH and AL - 8 bits each
2 hexadecimal digits each
- EBX, ECX, EDX
- and BX, BH, BL, CX, CH, CL, DX, DH, DL
![Page 17: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/17.jpg)
Intel Registers (grouped by function)
Data Registers(general purpose)
Index Registers(used in string operations)
Pointer Registers(used in stack operations)
Accumulator register
Base register
Count register
Data register
Source Index register
Destination Index register
Stack Pointer register
Base Pointer register
EAX
EBX
ECX
EDX
ESI
ESP
EBP
EDI
![Page 18: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/18.jpg)
Segment Registers (16-bit)(hold segment addresses)
Control RegistersFlags register detail:
- bit 0 CF- bit 2 PF- bit 6 ZF- bit 7 SF- bit 10 DF- bit 11 OF
Intel Registers (grouped by function)
Code Segment register
Data Segment register
Stack Segment register
Extra Segment register
EIP
EFLAGS
Instruction pointer register
Flags register
CS
DS
SS
ES
![Page 19: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/19.jpg)
- immediate addressing
- the operand comes immediately after the instruction
e.g. MOV EAX, 12345678 or MOV AX, ABCD or MOV AH, 2A
- direct addressing
- specifies the address of the operand
e.g. MOV EAX, [0100] or MOV EAX, NUMBER
- register addressing
- specifies the register in which the operand is stored
e.g. MOV EAX, EBX
32-bit Addressing Modes
![Page 20: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/20.jpg)
Scientific Notation Format
NormalizedStandard Form Scientific Notation Scientific Notation
3.14159 3.14159 x 100 .314159 x 101
100,000 1.0 x 105 .1 x 106
.0001 1.0 x 10-4 .1 x 10-3
-1234 -1.234 x 103 -.1234 x 104
-1.234 3 -.1234 4
mantissa characteristic fraction exponent (or significand)
Scientific notation makes it relatively easy to work with very large or very small numbers- normalized scientific notation used in the computer is called floating point notation
![Page 21: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/21.jpg)
4-Decimal-Digit Floating Point Format
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
4
3
3
1
1
1
1
-1
0
0 0
0
-0
6
0
2
3.14159
100,000
.0001
-1234
( .314159 * 101)
( .1 * 106)
( .1 * 10-3)
( .1234 * 104)
![Page 22: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/22.jpg)
4-Decimal-Digit Floating Point Format
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
4
3
3
1
1
1
1
-1
0
0 0
0
-0
6
0
2
3.14159
100,000
.0001
-1234
Range: - defined by the number of digits in the exponent (-.99 x 10+99 .. +.99 x 10+99)
Precision: - defined by the number of digits in the fraction (2 digits of precision)
![Page 23: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/23.jpg)
- if the 4-decimal digit format is changed:
Fraction3 decimal digitsNormalizedSigned
Exponent1 decimal digitSigned
- the range is smaller (-.999*109 .. 999*109)
- there is a smaller distance between adjacent numbers- there is greater accuracy
![Page 24: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/24.jpg)
- if the 4-decimal digit format is changed:
Fraction1 decimal digitNormalizedSigned
Exponent3 decimal digitsSigned
- the range is increased
- accuracy is greatly decreased
![Page 25: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/25.jpg)
- if the 4-decimal digit format is changed:
Fraction1 decimal digitNormalizedSigned
Exponent3 decimal digitsSigned
- the range is increased
- accuracy is greatly decreased
- no matter what format is used- these numbers will generate 7 different regions of storage:
- a positive value region, - a negative value region and a - zero region- 2 overflow regions - 2 underflow regions
![Page 26: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/26.jpg)
Range and regions of value for a 4-decimal-digit floating point format:
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
![Page 27: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/27.jpg)
zero .10x100
.10x10-99 .99x1099-.10x10-99-.99x1099
-.10x100
Range of 4-decimal-digit floating point format: (using the number line)
(Absolutely not to scale)
overflow overflow
underflow
![Page 28: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/28.jpg)
Roundoff Error
If we store 3.14159 as we truncate (round down) to 3.1
If we store 3.14159 as we round up to 3.2
03 1
23
1
10
If we store 1234 as we round down to 120041 2 0
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
![Page 29: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/29.jpg)
Floating point formats:
- often stored in normalized scientific notation form(.xxxxxx * base exponent)
- precision (accuracy)- affected by the number of digits in the fraction- affected by the limits of binary representation
- range- determined by the number of digits in the exponent
- often generate a round-off error
![Page 30: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/30.jpg)
Binary Floating Point Formats
- most are based on dividing the binary number into 3 parts: - the sign (1 bit)
- 0 = positive, 1 = negative- the exponent
- uses excess-N notation- the fractional part
- will be normalized- the radix point
- will be to the left or right of the most significant bit- depending on the format used
A 32-bit floating point number:
or
![Page 31: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/31.jpg)
To calculate the fraction:
- we must know the position of the radix point - to the left or right of the most significant bit
![Page 32: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/32.jpg)
To calculate the fraction:
- we must know the position of the radix point- to the left or right of the most significant bit (it's to the left)
![Page 33: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/33.jpg)
To calculate the fraction:
- we must know the position of the radix point- to the left or right of the most significant bit (it's to the left)
- and the base that will be used to calculate the exponent- called the radix of exponentiation
- usually base 2, 8 or 16
![Page 34: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/34.jpg)
To calculate the fraction:
- we must know the position of the radix point- to the left or right of the most significant bit (it's to the left)
- and the base that will be used to calculate the exponent- called the radix of exponentiation
- usually base 2, 8 or 16 (we'll look at all three)
![Page 35: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/35.jpg)
To calculate the fraction:
- we must know the position of the radix point- to the left or right of the most significant bit (it's to the left)
- and the base that will be used to calculate the exponent- called the radix of exponentiation
- usually base 2, 8 or 16 (we'll look at all three)
To calculate the exponent:
- we must first normalize the fraction to find the exponent- using the radix of exponentiation
![Page 36: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/36.jpg)
To calculate the fraction:
- we must know the position of the radix point- to the left or right of the most significant bit (it's to the left)
- and the base that will be used to calculate the exponent- called the radix of exponentiation
- usually base 2, 8 or 16 (we'll look at all three)
To calculate the exponent:
- we must first normalize the fraction to find the exponent- using the radix of exponentiation
- if the exponent is stored in 7 bits (it's stored in 7 bits)- it uses excess-64 notation
- if the exponent is stored in 8 bits- it uses excess-127 notation
![Page 37: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/37.jpg)
The problem:
- how 0.00110 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 7 bits for the exponent - using excess-64 notation
- 24 bits for the fraction- normalized
- radix point to the left of the most significant bit
- the radix of exponentiation is 2
![Page 38: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/38.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
![Page 39: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/39.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- i.e. move the radix point to the right 9 bits
= 0.0000000001000001100010010011011101001012
![Page 40: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/40.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right 9 bits
= 0.0000000001000001100010010011011101001012
- on a computer using radix 2 the normalized form is:
= 0.100000110001001001101110 1001012 * (2-9)10
![Page 41: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/41.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right 9 bits
= 0.0000000001000001100010010011011101001012
- on a computer using radix 2 the normalized form is:
= 0.100000110001001001101110 1001012 * (2-9)10
the 24 bits we need for the fraction
![Page 42: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/42.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.100000110001001001101110 1001012 * (2-9)10
fraction exponent
![Page 43: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/43.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.100000110001001001101110 1001012 * (2-9)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -9 + 64 = 5510
- in radix 2: 01101112
![Page 44: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/44.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.100000110001001001101110 1001012 * (2-9)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -9 + 64 = 5510
- in radix 2: 01101112
Step 4: Put the number together
sign exponent fraction
0 0110111 100000110001001001101110or
3 7 8 3 1 2 6 E in hexadecimal
![Page 45: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/45.jpg)
The problem:
- how 0.00110 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 7 bits for the exponent - using excess-64 notation
- 24 bits for the fraction- normalized
- radix point to the left of the most significant bit
- the radix of exponentiation is 8- for radix 8 we move the radix point in sets of 3 bits (1 octal digit = 3 binary digits)
![Page 46: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/46.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right in sets of 3 bits
- and stay to the left of the msb
= 0.0000000001000001100010010011011101001012
![Page 47: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/47.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right in sets of 3 bits
- and stay to the left of the msb
= 0.0000000001000001100010010011011101001012
- on a computer using radix 8 the normalized form is:
= 0.100000110001001001101110 1001012 * (8-3)10
the 24 bits we need for the fraction
Note: the roundoff error is truncation error
- if the roundoff error was from rounding bit #31 would be a 1
![Page 48: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/48.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.100000110001001001101110 1001012 * (8-3)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -3 + 64 = 6110
- in radix 2: 01111012
![Page 49: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/49.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.100000110001001001101110 1001012 * (8-3)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -3 + 64 = 6110
- in radix 2: 01111012
Step 4: Put the number together
sign exponent fraction
0 0111101 100000110001001001101110or
3 D 8 3 1 2 6 E in hexadecimal
![Page 50: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/50.jpg)
The problem:
- how 0.00110 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 7 bits for the exponent - using excess-64 notation
- 24 bits for the fraction- normalized
- radix point to the left of the most significant bit
- the radix of exponentiation is 16- for radix 16 we move the radix point in sets of 4 bits (1 hexadecimal digit = 4 binary
digits)
(This was the short-form floating point format used on the IBM 370 computer)
![Page 51: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/51.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right in sets of 4 bits
- and stay to the left of the msb
= 0.0000000001000001100010010011011101001012
![Page 52: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/52.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the left of the most significant bit
- move the radix point to the right in sets of 4 bits
- and stay to the left of the msb
= 0.0000000001000001100010010011011101001012
- on a computer using radix 16 the normalized form is:
= 0.010000011000100100110111 01001012 * (16-2)10
the 24 bits we need for the fraction
Note: the roundoff error is is the same for rounding or truncation
- the next bit is a 0
![Page 53: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/53.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.010000011000100100110111 01001012 * (16-2)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -2 + 64 = 6210
- in radix 2: 01111102
![Page 54: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/54.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 0.010000011000100100110111 01001012 * (16-2)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: -2 + 64 = 6210
- in radix 2: 01111102
Step 4: Put the number together
sign exponent fraction
0 0111110 010000011000100100110111or
? in hexadecimal
![Page 55: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/55.jpg)
Conversion to/from floating point formats:
- decimal number to hexadecimal floating point format:
- convert decimal number to binary
- convert to normalized scientific form (varies)
- convert exponent to its excess-N form in binary
- add sign bit to exponent and fraction
- convert binary number to hexadecimal
![Page 56: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/56.jpg)
To decode the hexadecimal number 3E400000 (same format):
![Page 57: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/57.jpg)
To decode the hexadecimal number 3E400000 (same format):
The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000
0 6210 .012
![Page 58: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/58.jpg)
To decode the hexadecimal number 3E400000 (same format):
The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000
0 6210 .012
Sign: positive
Exponent: -210
Fraction: .012
![Page 59: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/59.jpg)
To decode the hexadecimal number 3E400000 (same format):
The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000
0 6210 .012
Sign: positive
Exponent: -210
Fraction: .012
The normalized form: .01 x (16-2) 10
![Page 60: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/60.jpg)
To decode the hexadecimal number 3E400000 (same format):
The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000
0 6210 .012
Sign: positive
Exponent: -210
Fraction: .012
The normalized form: .01 x (16-2) 10
The non-scientific binary form: .00000000012
![Page 61: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/61.jpg)
To decode the hexadecimal number 3E400000 (same format):
The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000
0 6210 .012
Sign: positive
Exponent: -210
Fraction: .012
The normalized form: .01 x (16-2) 10
The non-scientific binary form: .00000000012
The number in decimal: = 1/1024 or .0009765...10
![Page 62: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/62.jpg)
Conversion to/from floating point formats:
- decimal number to hexadecimal floating point format:
- convert decimal number to binary
- convert to normalized scientific form (varies)
- convert exponent to its excess-N form in binary
- add sign bit to exponent and fraction
- convert binary number to hexadecimal
- hexadecimal floating point format to decimal value
- convert hexadecimal number to binary
- determine sign, exponent and fraction
- convert exponent to its decimal form
- convert to normalized form
- convert to its non-scientific binary form
- convert to decimal
![Page 63: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/63.jpg)
The problem from Lab #9:
- how -46.7410 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 7 bits for the exponent - using excess-64 notation
- 24 bits for the fraction- normalized
- radix point to the left of the most significant bit
- the radix of exponentiation is 16- for radix 16 we move the radix point in sets of 4 bits (1 hexadecimal digit = 4 binary
digits)
(This was the short-form floating point format used on the IBM 370 computer)
![Page 64: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/64.jpg)
The problem from Lab #9:
- how -46.7410 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 7 bits for the exponent - using excess-64 notation
- 24 bits for the fraction- normalized
- radix point to the left of the most significant bit
- the radix of exponentiation is 16- for radix 16 we move the radix point in sets of 4 bits (1 hexadecimal digit = 4 binary
digits)
(This was the short-form floating point format used on the IBM 370 computer)
.74 * 2 = 1.48
.48 * 2 = 0.96
.96 * 2 = 1.92
.92 * 2 = 1.84
.84 * 2 = 1.68
.68 * 2 = 1.36
.36 * 2 = 0.72
.72 * 2 = 1.44
.44 * 2 = 0.88
.88 * 2 = 1.76
.76 * 2 = 1.52
.52 * 2 = 1.04
.04 * 2 = 0.08
.08 * 2 = 0.16
.16 * 2 = 0.32
.32 * 2 = 0.64
.64 * 2 = 1.28
.28 * 2 = 0.56
.56 * 2 = 1.12
![Page 65: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/65.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.10111101011100001012
Step 2: Normalize the fraction- move the radix point to the left of the most significant bit
- move the radix point to the left in sets of 4 bits- and stay to the left of the msb
= -00101110.10111101011100001012
- on a computer using radix 16 the normalized form is:
= -.0010111010111101011100002 * (162)10
the 24 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -.0010111010111101011100012 * (162)10
![Page 66: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/66.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.1011110101110000101012
Step 2: Normalize the fraction- move the radix point to the left of the most significant bit
- move the radix point to the left in sets of 4 bits- and stay to the left of the msb
= -00101110.1011110101110000102
- on a computer using radix 16 the normalized form is:
= -.0010111010111101011100002 * (162)10
the 24 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -.0010111010111101011100012 * (162)10
![Page 67: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/67.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.101111010111000010102
Step 2: Normalize the fraction- move the radix point to the left of the most significant bit
- move the radix point to the left in sets of 4 bits- and stay to the left of the msb
= -00101110.1011110101110000102
- on a computer using radix 16 the normalized form is:
= -.0010111010111101011100002 * (162)10
the 24 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -.0010111010111101011100012 * (162)10
![Page 68: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/68.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -.0010111010111101011100012 * (162)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: 2 + 64 = 6610
- in radix 2: 10000102
Step 4: Put the number together
sign exponent fraction
1 1000010 .001011101011110101110001or C 2 2 E B D 7 1 in hexadecimal
![Page 69: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/69.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -.0010111010111101011100012 * (162)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: 2 + 64 = 6610
- in radix 2: 10000102
Step 4: Put the number together
sign exponent fraction
1 1000010 .001011101011110101110001or C 2 2 E B D 7 1 in hexadecimal
![Page 70: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/70.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -.0010111010111101011100012 * (162)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: 2 + 64 = 6610
- in radix 2: 10000102
Step 4: Put the number together
sign exponent fraction
1 1000010 .001011101011110101110001or C 2 2 E B D 7 1 in hexadecimal
![Page 71: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/71.jpg)
IEEE Standard Floating Point Formats for the Intel 8087 microprocessor:
- the Short Real form: (uses excess-127 for the exponent)
![Page 72: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/72.jpg)
IEEE Standard Floating Point Formats for the Intel 8087 microprocessor:
- the Short Real form: (uses excess-127 for the exponent)
- the Long Real form: (uses excess-1023 for the exponent)
![Page 73: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/73.jpg)
The IEEE Short Real form: (and the Long Real form)
- divides the binary number into 3 parts:
- the sign (1 bit)- 0 = positive, 1 = negative
![Page 74: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/74.jpg)
The IEEE Short Real form: (and the Long Real form)
- divides the binary number into 3 parts:
- the sign (1 bit)- 0 = positive, 1 = negative
- the exponent-uses excess-N notation
- excess-127 for Short Real- excess-1023 for Long Real
-the radix of exponentiation is 2
![Page 75: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/75.jpg)
The IEEE Short Real form: (and the Long Real form)
- divides the binary number into 3 parts:
- the sign (1 bit)- 0 = positive, 1 = negative
- the exponent-uses excess-N notation
- excess-127 for Short Real- excess-1023 for Long Real
-the radix of exponentiation is 2
- the fractional part- normalized using the scientific notation method
- with the radix point to the right of the most significant bit (always a 1)- then the msb is implied in the number and not stored
- it's considered "hidden" in the floating point format
![Page 76: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/76.jpg)
More IEEE Standard Floating Point Formats for the Intel 8087 microprocessor
- the Temporary Real form: (uses excess-32767 for the exponent)
- the temporary real form: - uses normalized notation
- msb to the right of the binary point and NOT hidden
- there are also 4 additional formats to handle overflow and underflow
![Page 77: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/77.jpg)
The problem:
- how 0.00110 would be represented in a hypothetical machine- using a 32-bit floating point format (IEEE standard)
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 8 bits for the exponent - using excess-127 notation
- 23 bits for the fraction- normalized
- radix point to the right of the most significant bit- msb is "hidden"
- the radix of exponentiation is 2
![Page 78: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/78.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the right of the most significant bit
- move the radix point to the right 10 bits
= 0.0000000001000001100010010011011101001012
![Page 79: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/79.jpg)
Step 1: Convert 0.00110 to radix 2
0.00110 = 0.00040611156458
= 0.0000000001000001100010010011011101001012
Step 2: Normalize the fraction
- move the radix point to the right of the most significant bit
- move the radix point to the right 10 bits
= 0.0000000001000001100010010011011101001012
- on a computer using radix 2 the normalized form is:
= 1.00000110001001001101110 1001012 * (2-10)10
the 23 bits we need for the fraction
![Page 80: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/80.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 1.00000110001001001101110 1001012 * (2-10)10
fraction exponent
Step 3: Convert the exponent to its excess-127 form in radix 2
- in radix 10: -10 + 127 = 11710
- in radix 2: 011101012
![Page 81: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/81.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= 1.00000110001001001101110 1001012 * (2-10)10
fraction exponent
Step 3: Convert the exponent to its excess-127 form in radix 2
- in radix 10: -10 + 127 = 11710
- in radix 2: 011101012
Step 4: Put the number together
sign exponent fraction
0 01110101 00000110001001001101110or
3 A 8 3 1 2 6 E in hexadecimal
![Page 82: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/82.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
![Page 83: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/83.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000
0 12410 .12
![Page 84: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/84.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000
0 12410 .12
Sign: positive
Exponent: -3
Fraction: 1.1
![Page 85: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/85.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000
0 12410 .12
Sign: positive
Exponent: -3
Fraction: 1.1
The normalized form: 1.1 x (2-3)10
![Page 86: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/86.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000
0 12410 .12
Sign: positive
Exponent: -3
Fraction: 1.1
The normalized form: 1.1 x (2-3)10
The binary number: .00112
![Page 87: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/87.jpg)
To decode the hexadecimal number 3D400000 (IEEE format):
The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000
0 12410 .12
Sign: positive
Exponent: -3
Fraction: 1.1
The normalized form: 1.1 x (2-3)10
The binary number: .00112
The decimal number: 1/8 +1/16 or 3/16 or .187510
![Page 88: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/88.jpg)
Conversion to/from floating point formats:
- decimal number to hexadecimal floating point format:
- convert decimal number to binary
- convert to normalized scientific form (varies)
- convert exponent to its excess-N form in binary
- add sign bit to exponent and fraction
- convert binary number to hexadecimal
- hexadecimal floating point format to decimal value
- convert hexadecimal number to binary
- determine sign, exponent and fraction
- convert exponent to its decimal form
- convert to normalized form
- convert to its non-scientific binary form
- convert to decimal
![Page 89: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/89.jpg)
Monday, October 4
Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETICAssignment #6: DEBUG EXERCISES
Quiz(zes) due: Quiz #5: Base ArithmeticQuiz #6 (Complement Arithmetic)
Note: Quiz #7 (Debug) will be due next Monday
Emulator Progress Worksheet 1 will be due next Monday
Today is the cutoff date for all Simple Computer labs and assignments
And next Monday is the cutoff date for all arithmetic assignments and quizzes(Assignment #5, Quiz #5, Quiz #6, Optional Quizzes #5, #7 and #8)
Please note: The date of the midterm is Monday, October 18- an 8.5 in. * 11 in. cheat sheet will be allowed
We will review for the midterm next week
I recommend going over the midterm practice exercises before I discuss them on Monday
Don't forget the optional quiz: Debug
![Page 90: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/90.jpg)
The problem from Lab #9 (Part 2):
- how -46.7410 would be represented in a hypothetical machine- using a 32-bit floating point format
- 1 bit for the sign bit - (0 = positive, 1 = negative)
- 8 bits for the exponent - using excess-127 notation
- 24 bits for the fraction- normalized
- radix point to the right of the most significant bit- and the most significant bit is "hidden"
- the radix of exponentiation is 2- for radix 2 we move the radix point bit by single bit
(This is the IEEE standard short-form floating point format)
.74 * 2 = 1.48
.48 * 2 = 0.96
.96 * 2 = 1.92
.92 * 2 = 1.84
.84 * 2 = 1.68
.68 * 2 = 1.36
.36 * 2 = 0.72
.72 * 2 = 1.44
.44 * 2 = 0.88
.88 * 2 = 1.76
.76 * 2 = 1.52
.52 * 2 = 1.04
.04 * 2 = 0.08
.08 * 2 = 0.16
.16 * 2 = 0.32
.32 * 2 = 0.64
.64 * 2 = 1.28
.28 * 2 = 0.56
.56 * 2 = 1.12
![Page 91: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/91.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.10111101011100001012
Step 2: Normalize the fraction- move the radix point to the right of the most significant bit
- move the radix point to the left bit by bit
= -00101110.10111101011100001012
- on a computer using radix 16 the normalized form is:
= -1.011101011110101110000102 * (25)10
the 23 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -1.011101011110101110000112 * (25)10
![Page 92: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/92.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.10111101011100001012
Step 2: Normalize the fraction- move the radix point to the right of the most significant bit
- move the radix point to the left bit by bit
= -00101110.10111101011100001012
- on a computer using radix 16 the normalized form is:
= -1.011101011110101110000102 * (25)10
the 23 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -1.011101011110101110000112 * (25)10
![Page 93: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/93.jpg)
Step 1: Convert -46.7410 to radix 2
-46.7410 = -101110.10111101011100001012
Step 2: Normalize the fraction- move the radix point to the right of the most significant bit
- move the radix point to the left bit by bit
= -00101110.10111101011100001012
- on a computer using radix 16 the normalized form is:
= -1.011101011110101110000102 * (25)10
the 23 bits we need for the fraction
Step 3: - the roundoff error is is from rounding - the next bit is a 1
- the normalized form becomes
= -1.011101011110101110000112 * (25)10
![Page 94: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/94.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -1.011101011110101110000112 * (25)10
fraction exponent
Step 3: Convert the exponent to its excess-127 form in radix 2
- in radix 10: 5 + 127 = 13210
- in radix 2: 100001002
Step 4: Put the number together
sign exponent fraction
1 10000100 .01110101111010111000011or C 2 3 A F 5 C 3 in hexadecimal
![Page 95: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/95.jpg)
Step 4: Put the number together
sign exponent fraction
1 10000100 .01110101111010111000011or C 2 3 A F 5 C 3 in hexadecimal
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -1.011101011110101110000112 * (25)10
fraction exponent
Step 3: Convert the exponent to its excess-127 form in radix 2
- in radix 10: 5 + 127 = 13210
- in radix 2: 100001002
![Page 96: Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC](https://reader036.fdocuments.in/reader036/viewer/2022081513/56812b43550346895d8f5886/html5/thumbnails/96.jpg)
- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10
= -1.010111010111101011100012 * (25)10
fraction exponent
Step 3: Convert the exponent to its excess-64 form in radix 2
- in radix 10: 5 + 127 = 13210
- in radix 2: 100001002
Step 4: Put the number together
sign exponent fraction
1 10000100 .01110101111010111000011or C 2 3 A F 5 C 3 in hexadecimal