Question: B) Encoding of float numbers In this problem, we focus on the problem of encoding float numbers on a computer. We recall some useful formulas:

 B) Encoding of float numbers In this problem, we focus on

B) Encoding of float numbers In this problem, we focus on the problem of encoding float numbers on a computer. We recall some useful formulas: - Scientific format in base 2: where (significand) and is an integer (exponent) - The exponent can be computed as: - The significand can be computed as for this exercise, we assume that we use single precision. In Matlab, you can define a number in single a) Pick a random number between 1,000,000,000 and 2,000,000,000. Find the exponent of the number you chose, as well as the significand b) Convert the significand in base 2 c) Input your number on https://www.h-schmidt. net/FloatConverter/IEEE754.html and check that the significand and exponents are what you have found in a) and b) d) Compute the machine epsilon for the IEEE 754 format (single precision). Use this to predict the maximal error on the number due to encoding, and check that the actual encoding error is less than this upper bound. Hint: the maximum error when encoding a number is e) Now, define the number (Matlab: pi) in two variables x and why, where x is a single precision variable, and y is a double precision variable (default in Matlab): x= single(pi) y= double(pi) Type the command "format long" to display all the digits of the numbers x and y. How many significant digits should x and y have (based on their corresponding epsilon)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!