Fixed-Point Variable Support : Implementation Method

Implementation Method

MicroC uses the “2 factorials” implementation method— redefining the least significant bit (LSB) to represent zero, or the negative power of 2. This implementation method provides reasonable code size and run-time performance, but is not the most accurate method.

Consider the binary 8-bit value 0b00010001. Usually, the value represented here is “17” because:

The 5th bit corresponds to 24 (16). Rescaling that value to begin at 2-3 gives:

2.125 = 1*2-3 (or 0.125) + 1*21 (or 2)

 

 

The parameter required here is the power (of 2) represented by the LSB. This is also the resolution.