Jump to navigation Jump to search This article is about a form of fixed-precision arithmetic tema 1 numeros reales 4 eso option binary computing. A value of a fixed-point data type is essentially an integer that is scaled by an implicit specific factor determined by the type. 1000, and the value 1,230,000 can be represented as 1230 with a scaling factor of 1000.

However, other scaling factors may be used occasionally, e. 3600 to obtain values with one-second accuracy. Thus, for example, to convert the value 1. To add or subtract two values of the same fixed-point type, it is sufficient to add or subtract the underlying integers, and keep their common scaling factor. To multiply two fixed-point numbers, it suffices to multiply the two underlying integers, and assume that the scaling factor of the result is the product of their scaling factors. To divide two fixed-point numbers, one takes the integer quotient of their underlying integers, and assumes that the scaling factor is the quotient of their scaling factors.

The first division involves rounding in general. The two most common classes of fixed-point types are decimal and binary. 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.