35.9k views
2 votes
(a) A rational number x is stored in half-precision floating point as the word CAFE16. (That's hex shorthand for the 16-bit binary word.) Write x in ordinary decimal notation.

Given that 1/7=0.001₂, find the word representing -4/7 as accurately as possible in half-precision floating point. Give your answer using hex shorthand, like the word you were given for (a).

User Rama Rao M
by
7.6k points

1 Answer

6 votes

Final answer:

In half-precision floating point, x = -50.9375 when CAFE16 is converted to decimal notation. -4/7 is represented as -0.0096 in hex shorthand.

Step-by-step explanation:

In half-precision floating point, a rational number is stored as a 16-bit binary word. To write x in decimal notation, we convert the hex value CAFE16 to binary (11001010111111116) and then divide it by 2^10 because the exponent is stored separately. This gives us the decimal value -50.9375.

To find the word representing -4/7, we can use the fact that 1/7 is approximately 0.0012 in binary. Multiplying this by -4 gives us -0.0048, which is approximately represented as -0.0096 in half-precision floating point. Converting this to hex gives us 9C0016.

User CharlyKeleb
by
7.7k points