Ass1 - Department of Electrical and Computer Engineering...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Department of Electrical and Computer Engineering ECSE 221 – Introduction to Computer Engineering 1 Assignment 1 Due: January 28, 2008 at 5:00pm The assignment is due Monday, January 28th, 2008, by 5:00 pm in the Trottier assignments box. Late submissions will be accepted subject to a 5% per day penalty. No assignments will be accepted after February 1st. All answers, code and tests should be made according to instructions and submitted in paper form in a sealed 8.5”x11” envelope with your name, ID, course number and assignment number on the outside of the envelope. In addition, the source code for Questions 4-7 must be submitted on a CD or floppy to be inserted in the envelope along with the paper copy. (Future code submissions will be made via WebCT). Question 1 Convert the following integers into their numerical equivalents in the indicated bases. Be sure to use the correct number of significant figures for each case and show how the correct number of significant figures was obtained. a) 2102.2201 3 b) 5402.504 6 i) X 2 i) X 2 ii) X 7 ii) X 5 iii) X 9 iii) X 10 iv) X 16 iv) X 16 Question 2 Perform the following using binary long division. Show all your work. 101001010010 / 10100 Question 3 a) Convert -3.072 x 10 -12 to single precision IEEE 754 using the procedure described in class and in the notes. Compute all 23 bits of the mantissa. b) Convert the following IEEE 754 representation into its decimal equivalent (to 3 decimal places): 0x9d9ff4bc. c) Excluding the special case of de-normalized numbers, determine how many distinct real numbers can be represented by a single precision IEEE 754 number.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 4 Write a command line program using the “C” programming language that takes a decimal number as input and outputs an 8-digit hexadecimal number corresponding to its IEEE 754 binary representation. Your program should replicate the examples shown below (except for the prompt). % toieee -341.274 IEEE754 (-341.274) = c3aaa312 % toieee 6.02e23 IEEE754 (6.02e23) = 66fef4f9 % toieee 3.4e38 IEEE754 (3.4e38) = 7f7fc99e % toieee -3.4e38 IEEE754 (-3.4e38) = ff7fc99e % toieee -3.072e-12 IEEE754 (-3.072e-12) = should be equal to what you computed for Question 3a. Explain any discrepancies. Hint: The computer can do all of the hard work for you. All you need to do is figure out how to output the machine’s internal representation. Question 5 Using the code in the notes for binary division (or roll your own if you so desire), write a “C” language function to perform signed binary division according to the following prototype: int div32(long dividend, long divisor, long *quotient, long *rmdr); The function should return a value of 0 on successful completion and -1 otherwise (i.e. a divide by zero error). Write a command line program that invokes your function as follows, replicating the examples
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course ESCE 221 taught by Professor Ferrie during the Spring '08 term at McGill.

Page1 / 16

Ass1 - Department of Electrical and Computer Engineering...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online