Please explain in layman's terms.
|
|
There are two major differences between the two:
For details of the binary format, and the math behind the binary format, see the Wikipedia articles for fixed point arithmetic and Floating point numbers. Floating Point Numbers: Within the limits of the binary representation, floating point numbers represent arbitrary precision. In short, you can represent really tiny numbers or really big numbers. The number of decimal places you can represent are only limited by the number of bits dedicated to the number. These are commonly used in physics and other more precise math problems. Fixed Decimal Numbers: Have a constant number of digits after the decimal place. These are typically used to represent money, percentages, or a certain precision of the number of seconds (i.e. limiting to milliseconds). They are mostly used in databases as a simple and efficient storage format. The math involved with these types of numbers have no practical significance for any precision lower than the fixed number of decimal places. What practical use is 1/1000th of a penny? |
|||||||||
|
|
I think your are talking about floating-point numbers and fixed-point numbers. Whether they are decimal or binary is beside the point here. In layman's terms, think of a decimal fraction represented in the scientific notation, like 5.3 x 10^-3. You can adjust the exponent so that the significant digits are represented as an integer, e. e. 5.3 x 10^-3 = 53 x 10^-4. In other words, you can get rid of the decimal point. Thus, any decimal can be represented as two parts: an integer, called the mantissa, and the exponent, which is the appropriate power of 10. Now imagine that you have a fixed number of digits that you can use to represent your number. Some of those digits have to be used to represent the mantissa, and some must be used for the exponent. In the case of a fixed-point number, you decide ahead of time how many digits to use for the mantissa, and how many for the exponent. In the case of a floating point number you can adjust how many digits to use for each part on the fly, depending how many significant digits your number has. All of this is just as true for binary or hex fractions, as it is for decimals. The floating-point representation allows you to get a better precision for the same number of digits, but it is more complicated, meaning that it requires more CPU instructions per operation. |
|||
|
|
|
Fixed point numbers have the decimal always at the same position. For example, an 8-digit fixed-point decimal system with the decimal between the 4th and 5th positions would represent 123.45 and 6789 as 0123.45 and 6789.0000. It could not represent 1,234,567,890, however, nor 0.00000000009. Floating point numbers use scientific notation. They define a certain number of "significant digits, and represent every number as so many integers and so many decimal points times the base number of the system to an exponent value. For example, 123.45 and 6789 could be represented by 1234.5000 x 10^-1 and 6789.0000 x 10^0, or they could be represented with a single digit before the decimal place, 1.2345000 x 10^2 and 6.7890000 x 10^3. 1,234,567,890 would be represented as 1.23445678 x 10^9 in this last example. 0.00000000009 would be represented as 9.0000000 x 10^-10. Because the decimal isn't fixed, floating point numbers can represent a much larger set of numbers, from very small values (with a large negative exponent) to very large values (with a large positive exponent). Note that in the computer, base 2 (0's and 1's - binary) is used instead of base 10 (digits 0 through 9, or decimal). |
|||
|
|
|
i think this is what you looking for (taken from Floating Point/Fixed-Point Numbers):
|
|||||||
|
|
Basically, a fractional number's bit representation (e.g. 32 bits of a single floating point number) can be split in two, the whole part and fractional part. With floating point representation, that point of split is essentially 'floating' between the whole part and fractional part, enabling you to represent either greater quantities or more precise quantities. IEEE's definition of floating point numbers is actually very clever, albeit initially difficult to grasp: http://en.wikipedia.org/wiki/Floating_point. A fixed-precision value is just an integer with a (commonly assumed) fixed scaling factor (e.g. 1/2^n), meaning that a fixed number of bits (n) from that integer will be considered as the number's fractional part: http://en.wikipedia.org/wiki/Fixed_precision. Fixed-precision numbers are used on hardware platforms that do not include floating-point computation and for computational efficiency. The given Wikipedia articles and their references are really good sources of further information. |
|||
|
|
|
How Floating Point Numbers Work: Imagine that you have a fictional 'computer system' that can only store base-10 numbers in spaces that are 8 characters wide, AND it can only hold the numeric characters 0 through 9 but not the decimal character '.' . How should your system handle the variety of numbers that programmers need to use? In a world that only has positive discrete values (0, 1, 2, ...) that are relatively small (less than 100 million) you won't have any problems fitting your numbers in the 8-character spaces: However, we live in a world with numbers that are negative also. In real-world computer systems, most machines use the most significant bit to track if a value is positive or negative. In our fictional computer we would waste a lot of space using one whole character to track if a value is positive or negative. Instead of holding 100 million different values we'd be limited to only 20 million values (-10 million to +10 million)--we just lost 80 million values. One way to fix this is to use an offset--we shift all the values so that We can increase the range of the magnitude if we're willing to sacrifice precision. If we reserve the right-most 2 characters to store an exponential, then we can use the left-most 6 character for the precision. We still use an offset to handle negative numbers, which becomes So that's how we handle really big numbers in a space of only 8 character, but we don't have a way of handling fractional numbers. How do we represent PI, or e, or the Avagadro constant? One way is to pretend that there's a decimal point just to the left of each of our storage spaces--that means that the number One last hurdle... ...How do we represent values that are much smaller than 1, i.e. how many meters is 1 Bohr? For this we have to have a way of representing negative numbers in our 2-character exponential space. We do this the same way we handle negative numbers in the precision space--we use an offset. With a 2-character space we choose an offset where This is the gist of how floating point numbers work. They always store as many precision characters as possible and use the exponential number to adjust for where the decimal point is in relation to the precision characters. As you can imagine, doing math on these numbers involves a lot of steps in order to account for differences in the exponential values. What number should we expect when we subtract How Fixed Point Numbers Work: Because math with floating point numbers is so much slower than dealing with discrete (integer) numbers, you can simulate fractional values using integer numbers. We'll use our same fictional computer system that can only store base-10 numbers in an 8-character space. We understand how to represent the values 0 through 100 million in that space, because we already covered that above, but how do we represent the fractional value 1/2 without using the weird tricks we used for floating point numbers? With our floating point number system we sacrificed precision in order to gain magnitude; with fixed-point numbers we sacrifice magnitude so that we can keep our precision and gain fractions. In our floating point number system we pretended that there was an invisible decimal point just to the left of our precision digits; with fixed-point numbers we choose a place between two digits and imagine that there's a decimal point there. Depending on how big of a number we need to represent, we can adjust where the decimal point goes. If, for instance, we're dealing with trigonometric functions and we need PI and values between 0 and +1, then we can imagine that the decimal point is just to the right of the most significant digit. We would store PI as If we use a fixed-point system with the decimal point between the 4th and 5th digits, then PI is represented as Summary Hopefully, that explanation gives you a better understanding of how the two number systems work and relative strengths and weaknesses of each. Of course a real computer system does this all in binary instead of base-10, but the concepts are the same. There are also some reserved patterns of bits in the floating point number system to represent +infinity, -infinity, the very smallest values on either side of 0, and NaN. Fixed-point numbers do not have any reserved patterns, and typically use the most significant bit to represent positive or negative values, just like regular integers. |
|||
|
|
|
He said decimal floating point, rather than floating point. That would be a floating point representation that stores and retrieves its data in base ten. Rather than bits which represents ones, and zeroes, several bits (probably, but not necessarily 4bits) encodes the digits 0:9. Also the exponents represent powers of ten, rather than powers of two. Floating point arthmetic is performed in this system -probably in a manner similar to what you learned in grade school. Rounding is to the nearest decimal digit. You will get different answers with this system (for roughly equivalent precision) than from using the conventional binary encoding. The later can be a hastle in certain applications, as for example the number .1 cannot be exactly represented in binary floating point form (no matter how many bits of precision you have), but is exact in the decimal floating system. Of course decimal storage is inefficient, and usually the floating point operations (adds, subtracts multiplies divides) must be dome in hardware (probably an expensive library call), rather than in a binary floating point unit. Once upon a time some computers were built with actual decimal floating point units (I think it was probably IBM). I think fixed point resmbles the above, but a fixed decimal exponent is assumed. |
|||
|
|
The difference is this: If there could be any number of digits following the decimal it is considered floating decimal and if there is a 'fixed' number of digits after the decimal is fixed decimal. |
||||
|
|