Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (20pts) A single-precision floating point number uses 32 bits of storage: 1 b

ID: 3596238 • Letter: 1

Question

1. (20pts) A single-precision floating point number uses 32 bits of storage: 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa. The largest number that can be stored is: (1 +2-1+2-2++2-23) x 2(20--1) (2-2-23) x 2127 2128 -2104 3.4 x 1038 The smallest positive number that can be stored is: 1×2 -(20-1))-2-128 ~ 2.9 × 10-39 And the machine epsilon is: 2-23 ~ 1.2 × 10-7 MATLAB by default stores numbers as 64 bit double precision floats: 1 bit for the sign, 11 bits for the exponent and 52 bits for the mantissa. a) b) c) d) What is the largest double-precision floating point number? (4pts) What is the smallest positive double-precision floating point number? (4pts) What is the machine epsilon for a double-precision floating point number? (4pts). What is the total number of distinct values that can be stored with a single-precision floating point number? (4pts) What is the total number of distinct values that can be stored with a double-precision floating point number? (4pts) e) Give all answers in terms of powers of 2 as well as a 2-significant figure decimal approximation.

Explanation / Answer

As it can be seen from the single precision floating points,

a) Largest floating point number : ( 1+2^-1 + 2^-2 + 2^-3 + ... + 2^-52) * (2(2^(11-1) - 1))

= (2 - 2-52) * 21023

b) Smallest floating point : 1 * 2-(2^(11-1))

C) Machine epsilon is : 2^-52

d) Number of distinct values that can be stored in a singe-precision floating point number, counting zero only one and not counting infinities will be 2^32

e) Number of distinct values that can be stored in a double-precision floating point number, counting zero only one and not counting infinities will be 2^64