## Sunday, February 03, 2008

### Build an Interface using Fixed-Point Arithmetic: I. Introduction

We know and use floating-point implementation from the first day of computing. However, not all of us have ever implemented a fixed-point algorithsm, simply because we didn't need to. Recently, I have got such a chance to learn and use fixed-point stuff seriously.

Wikipedia defines fixed-point arithmetic as: "a fixed-point number representation is a real data type for a number that has a fixed number of digits after (and sometimes also before) the radix point (e.g., after the decimal point '.' in English decimal notation)."

Modern computing normally uses more complicated (and more computationally demanding) floating point number representations. However, fixed-point arithmatic is useful in building generic, platform-independent interfaces. So what is good about a fixed-point algorithm?

1) Platform (hardware and OS) independent
2) Network neutral

Note that because fixed point operations can produce results that are larger than the integer can represent, there is possibility for information loss. For example, the result of fixed point multiplication could double the number of bits in the two operands. In order to fit the result into the same number of bits as the operands, the answer must and will be truncated.

In computing, it's more convenient to use binary numbers than decimal numbers. The fixed-point integers are often represented as binary number. Thus, the "point" in the fixed-point arithmetic here means the binary point, not the decimal point.

In next post, I'll explain some fixed-point fundamentals by a real life, simple fixed-point algorithm.