-4

floating point representations##

exponent == 7 bits ,mantissa == 8 bits

  1. 2044    = 0 1001001 11111111
  2. 2045.5 = 0 1001001 11111111

why is this happening?? what is the error? Is anything wrong with the conversion?

1
  • 3
    Look up precision, accuracy, and significant digits. Also read the links on the "related" side-bar. Commented Sep 28, 2022 at 23:17

1 Answer 1

4

Not sure what format this, as IEEE 16-bit float has 5 bit exponent and 10 bit mantissa (with hidden 1 bit, so effective 11 bits).

However, your format has more exponent bits and fewer mantissa bits than the standard one.  With only 8 bits of mantissa, only 256 different values can be differentiated at the same exponent value.  While that is "ok" at lower exponent values (all integers can be represented, and further some fractions), as soon as the exponent value is larger than 29, then 256 is simply not enough bits to represent all the possible integers, let alone fractions.

2044 requires 11 bits and 2045.5 requires 12 bits to represent exactly. 

Your format may or may not utilize the hidden leading 1 common with IEEE formats.  If not then the numbers will be forced to round to 8 bits, and if so, then as if to 9 bits.  Either way, these two numbers cannot be differentiated with such limited mantissa.

These numbers require an exponent of around 211, which would require 11 bits to represent all possible integers (more for fractions).

1
  • I found this question in a past paper. First I have to give the 16-bit floating representation under those conditions(mantissa = 8 bits and exponent = 7 bits) then if I found any contradiction between the solutions I had to explain it. I gave my answer as 'there are not enough bits in mantissa to represent 2045.5' as my answer. I was not sure about it and That's why I posted it here. Thank you so much for your support, I think now I know the correct answer. Commented Sep 29, 2022 at 3:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.