Search code examples
floating-pointbinaryieee

The numeric value of a IEEE floating point representation


I am studying for an exam and I am confused about finding the "V" (The numeric value represented) and "f" fraction, in floating point rep

Let us use this example
16 bit:

|S (1 bit)|exp( 7 bit)|M (8 bit)|

Find:
exp: the value represented by considering the exponent field to be an unsigned integer
E: the value of the exponent after biasing
M: the value of the significant
V: the numeric value represented
f: the value of the fraction

Start with: 10.0000001

  1. Find our Bias: 2^(k-1)-1, Bias = 2(^6)-1 = 63
  2. Shift decimal: 1.00000001, E = 1 from a 2^1 shift
  3. M is to the right of the decimal, M = 00000001
  4. Find exp = E = exp - Bias, exp = 64
  5. sign bit is 0 when looking to the bit right after the decimal

Is this correct so far?

So our fp rep is : 0100000000000001 Hex: 0x4001

Now my question what is f and V?

I understand V is found from -1^s*M*2^E but I seem to have something messed up.


Solution

  • V is the value you started with, 10.00000012. Either the formula for V is incorrect (it should have f in place of M, so V = (-1)2·f·2E) or the definition of M is incorrect (it should be the entire fraction, not the portion with the initial 1 removed).

    f is the fraction portion of the representation. For normal values, f = 1+M. (For subnormal values, f = 0+M.) So, in this example, f is 1.000000012.

    Additionally, the sign bit is not taken from the bit to the right of the radix point. The sign bit is 0 if the number is positive and 1 if the number is negative.