Fixed-point Arithmetic - Precision Loss and Overflow

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:

    How should the world be luckier if this house,
    Where passion and precision have been one
    Time out of mind, became too ruinous
    To breed the lidless eye that loves the sun?
    William Butler Yeats (1865–1939)

    California is a place in which a boom mentality and a sense of Chekhovian loss meet in uneasy suspension; in which the mind is troubled by some buried but ineradicable suspicion that things had better work here, because here, beneath that immense bleached sky, is where we run out of continent.
    Joan Didion (b. 1935)

    Oh! that thy love might overflow my Heart!
    To fire the same with Love: for Love I would.
    But oh! my streight’ned Breast! my Lifeless Sparke!
    My Fireless Flame! What Chilly Love, and Cold?
    In measure small! In Manner Chilly! See!
    Lord, blow the Coal: Thy Love Enflame in mee.
    Edward Taylor (1645–1729)