Computer programming - Homework 5

1.Reverse bits Write a function that takes a number and returns a number with all bits in reverse order. Write two variants: reverse the entire bitwidth: reverse(13) = 10110000....0 or just the low-order relevant part: reverse(13) = 1011 (that is, eleven).

2. Construct floating point Write a function that takes two unsigned numbers with n <= m < 2n and computes the 23-bit mantissa (fractional part) of m/n using bitwise ops. Then construct the entire floating-point number.
Use *(float *)&n to obtain a float with the same bit pattern as the int n.

Marius Minea
Last modified: Tue Oct 20 13:45:00 EEST 2015