Lecture 3
●
MEEN 357 Homework Solution
1
Lecture03HomeworkSolution2009.doc
RMB
1.
Convert the following 64 bit number to a real number:
1
10010001111
1100001101010000000010000000000000000000000000000000
S
Exp
M
=
=
=
Solution:
There are a lot of different ways to do the arithmetic, including by hand.
Below is script for an mfile that will make MATLAB do the calculation.
%calculates number from 64 bit IEEE binary number.
Not
%fancy.
...Uses
%notation in 357 notes.
clc
clear
all
format
long
S=1
%Calculation of E
%You are given
Exp=[1 0 0 1 0 0 0 1 1 1 1]
%Next build the formula (3.41)for E
K=10:1:0;
N=2.^(K);
E=N*Exp'
%Next build the formula (3.45) for f
%Build a matrix for all of the given and leading zeros in M
Q=zeros(1,31)
%Concatenate Q with the other given entries in M
M=[1,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1,Q]
K=1:52;
L=1./(2.^(K));
f=M*L';
%calculation of v from the table on page 17 of the notes
%for Lecture 3
format
long
e
v=(1)^S*(1+f)*2^(E1023)
%While not necessary, you can display your results as
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 ANAMALAI
 Decimal, Lecture03HomeworkSolution2009.doc RMB

Click to edit the document details