Problems from _Computer Systems: A Programmer's Perspective_ (temporarily excerpted here until book copies arrive in the bookstore): 2.83 Fill in the return value for the following procedure, which tests whether its first argument is less than or equal to its second. Assume the function f2u returns an unsigned 32-bit number having the same bit representation as its floating-point argument. You can assume that neither argument is NaN. The two flavors of zero, +0 and -0, are considered equal. int float_le(float x, float y) { unsigned ux = f2u(x); unsigned uy = f2u(y); /* Get the sign bits */ unsigned sx = ux >> 31; unsigned sy = uy >> 31; /* Give an expression using only ux, uy, sx, and sy */ return______________________; } 2.86 Consider a 16-bit floating-point representation based on the IEEE floating-point format, with one sign bit, seven exponent bits (k = 7), and eight fraction bits (n = 8). The exponent bias is 2^(7-1)-1 = 63. Fill in the table that follows for each of the numbers given, with the following instructions for each column: Hex: The four hexadecimal digits describing the encoded form. M: The value of the significand. This should be a number of the form `x' of `x/y', where x is an integer, and y is an integral power of 2. Examples include: 0, 67/64, and 1/256. E: The integer value of the exponent. V: The numeric value represented. Use the notation x or x * 2^z, where x and z are integers. As an example, to represent the number 7/8, we would have s = 0, M = 7/4, and E = -1. Our number would therefore have an exponent field of 0x3E (decimal value 63 - 1 = 62) and a significand field 0xC0 (binary 11000000_2), giving a hex representation 3EC0. You need not fill in entries marked "---". Description Hex M E V -0 --- Smallest value > 2 512 --- Largest denormalized -infinity --- --- --- Number with the hex representation 3BB0 --- 2.88 We are running programs on a machine where values of type `int' have a 32-bit two's complement representation. Values of type `float' use the 32-bit IEEE format, and values of type `double' use the 64-bit IEEE format. We generate arbitrary values x, y, and z, and convert them to values of type `double' as follows: /* Create some arbitrary values */ int x = random(); int y = random(); int z = random(); /* Convert to double */ double dx = (double) x; double dy = (double) y; double dz = (double) z; For each of the following C expressions, you are to indicate whether or not the expression always yields 1. If it always yields 1, describe the underlying mathematical principles. Otherwise, give an example of arguments that make it yield 0. Note that you cannot use an IA32 machine running gcc to test your answers, since it would use the 80-bit extended representation for both `float' and `double'. A. (float) x == (float) dx B. dx - dy == (double) (x-y) C. (dx + dy) + dz == dx + (dy + dz) D. (dx * dy) * dz == dx * (dy * dz) E. dx / dx == dz / dz