misc : fixed point arithmitic

Structure

So a nubmer is made of a whole part and a fractional part. So something that's 4:4 has the high-nibble is the whole part, and the low-nibble is the fractional part. So for unsigned numbers, the range of the above would be 0 to 15 for the whole part.

The fractional part works very much the same, except kinda in reverse. The highest order bit of the fractional part is 1/(2^1), or .5. The next highest is 1/(2^2), and so on. So with 4 bits, the largest fractional part you can use is 1/2 + 1/4 + 1/8 + 1/16 = 15/16th. So the total range of an unsigned 4:4 fixed point number is 0 to 15 + 15/16.

Operations