Content deleted Content added
Petedarnell (talk | contribs) |
Petedarnell (talk | contribs) No edit summary |
||
Line 3:
{{dablink|This article is about a form of limited-precision arithmetic in computing. For the fixed points of a mathematical function, see [[fixed point (mathematics)]].}}
In [[computing]], a '''fixed-point number''' representation is a [[real data type]] for a number that has a fixed number of digits after the decimal (
These numbers are useful for representing fractional values in native [[two's complement]] format if the executing processor has no [[floating point]] unit (FPU) or if fixed-point provides an
improved performance. Most low cost embedded processors do not have an FPU.
For example, a 16 bit signed fixed-point binary number with 4 bits after the decimal point yields 12 magnitude bits and 4 fractional bits. It can represent numbers between 2047.9375 and -2048. The asymmetry between upper and lower bounds is due to the two's complement notation. A 16 bit unsigned fixed-point binary number with 4 fractional bits ranges between 4095.9375 and 0. Fixed point numbers can represent fractional powers of two exactly, but, like floating point numbers, cannot exactly represent fractional powers of 10. If exact fractional powers of ten are desired, then [[Binary-coded decimal]] (BCD) format should be used. However, BCD does not make as efficient use of bits as two's complement notation, nor is it as computationally fast.
Line 9 ⟶ 10:
by two's complement fixed point or floating point representations, while they can be represented exactly in BCD representations.
Integer
A common use for fixed-point BCD numbers is for storing monetary values, where the inexact values
of floating-point numbers are often a liability.
The [[Ada programming language]] includes built-in support for both fixed-point and floating-point.▼
▲The [[Ada programming language]] includes built-in support
Very few computer languages include built-in support for fixed point values, because for most applications, floating-point representations are fast enough and accurate enough. Floating-point representations are
However, if they are needed, fixed-point numbers can be implemented even
|