Search code examples
fixed-point

What is the range of a float represented as a Q16.16 integer?


When encoding a floating point number as a fixed point integer Q16.16 with int(number * 0x10000), what is the range of floating point that can be represented without loosing precision ?


Solution

  • Range is 32767 to -32768 plus or minus the fractional part at maximum. So

    32767 + 65535/65536 to - 32768 - 65535/65536.

    However precision is a different thing to range. You've got up to 31 bits of precision.