Precision Loss and Overflow
Because fixed point operations can produce results that have more bits than the operands, there is possibility for information loss. For instance, the result of fixed point multiplication could potentially have as many bits as the sum of 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 be rounded or truncated. If this is the case, the choice of which bits to keep is very important. When multiplying two fixed point numbers with the same format, for instance with integer bits, and fractional bits, the answer could have up to integer bits, and fractional bits.
For simplicity, many fixed-point multiply procedures use the same result format as the operands. This has the effect of keeping the middle bits; the I-number of least significant integer bits, and the Q-number of most significant fractional bits. Fractional bits lost below this value represent a precision loss which is common in fractional multiplication. If any integer bits are lost, however, the value will be radically inaccurate. Some model-based fixed-point packages allow you to specify a result format different from the input formats. This allows you to maximize precision and avoid overflow.
Some operations, like divide, often have built-in result limiting so that any positive overflow results in the largest possible number that can be represented by the current format. Likewise, negative overflow results in the largest negative number represented by the current format. This built in limiting is often referred to as saturation.
Some processors support a hardware overflow flag that can generate an exception on the occurrence of an overflow, but it is usually too late to salvage the proper result at this point.
Modern development cycles include a prototyping phase which examines the potential precision loss and overflow of designs using fixed point calculations before proceeding to physical prototyping.
Read more about this topic: Fixed-point Arithmetic
Famous quotes containing the words precision, loss and/or overflow:
“Women on trains
have a life
that is exactly livable
the precision of days flashing past”
—Audre Lorde (19341992)
“Progress may feel more like loss than gain.”
—Mason Cooley (b. 1927)
“A mans interest in the world is only the overflow from his interest in himself. When you are a child your vessel is not yet full; so you care for nothing but your own affairs. When you grow up, your vessel overflows; and you are a politician, a philosopher, or an explorer and adventurer. In old age the vessel dries up: there is no overflow: you are a child again.”
—George Bernard Shaw (18561950)