Fixed-point Arithmetic - Binary Vs. Decimal

Binary Vs. Decimal

The two most common classes of fixed-point types are decimal and binary. Decimal fixed-point types have a scaling factor that is a power of ten; for binary fixed-point types it is a power of two.

Binary fixed-point types are most commonly used, because the rescaling operations can be implemented as fast bit shifts. Binary fixed-point numbers can represent fractional powers of two exactly, but, like binary floating-point numbers, cannot exactly represent fractional powers of ten. If exact fractional powers of ten are desired, then a decimal format should be used. For example, one-tenth (0.1) and one-hundredth (0.01) can be represented only approximately by binary fixed-point or binary floating-point representations, while they can be represented exactly in decimal fixed-point or decimal floating-point representations. These representations may be encoded in many ways, including BCD.

Read more about this topic:  Fixed-point Arithmetic

Famous quotes containing the word decimal:

    It makes little sense to spend a month teaching decimal fractions to fourth-grade pupils when they can be taught in a week, and better understood and retained, by sixth-grade students. Child-centeredness does not mean lack of rigor or standards; it does mean finding the best match between curricula and children’s developing interests and abilities.
    David Elkind (20th century)