You are on page 1of 4

UNIVERSITY OF VICTORIA

MIDTERM EXAM 1 FEBRUARY 7 2019


COMPUTER SCIENCE 349A

NAME: STUDENT NO.


INSTRUCTOR: Rich Little
. DURATION: 40 minutes
TO BE ANSWERED ON THE PAPER
STUDENTS MUST COUNT THE NUMBER OF PAGES IN THIS EXAMINATION PAPER BEFORE
BEGINNING TO WRITE, AND REPORT ANY DISCREPANCY IMMEDIATELY TO ME.
PLEASE PUT YOUR NAME ON THE VERY BACK SHEET AS WELL.
THIS QUESTION PAPER HAS 4, SINGLE-SIDED PAGES. YOU MAY USE THE BACK
PAGES.
NOTES: (0) CLOSED BOOK EXAM; ONLY BASIC CALCULATORS ARE ALLOWED, (1)
ANSWER ALL QUESTIONS, (2) THERE ARE A TOTAL OF 18 MARKS, (3) THE BACK
PAGE OF EACH QUESTION MAY BE USED FOR YOUR ANSWERS. (4) STUDENTS ARE
ALLOWED ONE 8.5-by-11 INCH SHEET CONTAINING ANY INFORMATION — BOTH
SIDES CAN BE USED.

Question Possible marks Actual marks


1 6
2 6
3 6
Total 18
FEB 7, 2019 CSC 349A, 2

1. (a) [4 points] Evaluate


x − sin x
g(x) =
x3
using b = 10, k = 4 floating-point arithmetic with chopping where x = 0.02468
radians.
(b) [2 points] Given that the actual value is g(0.02468) = 0.1666616, what is the relative
error of your approxiamtion in (a)?
FEB 7, 2019 CSC 349A, 3

2. Consider a base-5 normalized, floating-point number system. Assume that a hypothetical


computer using this system has the following floating-point representation:

sm d1 d2 d3 d4 se e1 e2

where sm is the sign of the mantissa, se is the sign of the exponent (1 for negative, 0 for
positive), di are the digits of the mantissa, and ej are the digits of the exponent.

(a) [2 points] Consider the base-5 number, using the above representation, 02003004.
What exact decicmal value does it represent?
(b) [4 points] How does the above hypothetical base-5 computer represent the decimal
value −25.8?
FEB 7, 2019 CSC 349A, 4

3. (a) [4 points] Determine the second order (n = 2) Taylor approximation for f (x) =
ln (x − 1), expanded about a = 2, including the remainder term. Do not simplify the
form of this polynomial; that is, do not multiply out any powers.
(b) [2 points] What is the upper bound on the error in (a) when approximating ln (1.2)?

You might also like