C Programming Mystery Numbers 20 points In the following code we have omitted

C programming mystery numbers 20 points in the

This preview shows page 3 - 5 out of 9 pages.

Problem 2: C Programming: Mystery Numbers (20 points)In the following code, we have omitted the definitions of constants M and N:#define M/* Mystery number 1 */#define N /* Mystery number 2 */unsigned int arith(unsigned int x, unsigned int y){unsigned int result = 0;result = x * M + y/N;return result;}We compiled this code for particular values of M and N. The compiler optimized the multiplication anddivision. The following is a translation of the generated machine code back into C:unsigned int optarith(unsigned int x, unsigned int y){unsigned int t = 3 * x;x <<= 6;x -= 2 * t;y >>= 4;y = y/3;return x + y;}What are the values of M and N? (show work) 3
Image of page 3
Problem 3: Data Representation (20 points)1. (16 points) Consider a 5-bit floating-point representation based on the IEEE floating point format withone sign bit, two exponent bits, and two fraction bits.(1 point) What is the bias in this representation?(3 points) Provide the following information for the largest normal positive number in thisrepresentation?sign bit:exponent bits:mantissa bits:(3 points) Provide the following information for the largest denormal positive number in thisrepresentation?sign bit:exponent bits:mantissa bits:(3 points) Provide the following information for the smallest normal positive number in thisrepresentation?sign bit:exponent bits:mantissa bits:(3 points) Provide the following information for the smallest denormal positive number in thisrepresentation?
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 9 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture