Please explain in layman's terms.

  • 3
    Is this homework?
    – Job
    Mar 25, 2011 at 18:45
  • 1
    @Job: No Sir, I am trying to understand data types.
    – user21186
    Mar 25, 2011 at 18:49
  • 1
    Ok, if you have 128 bits to represent a decimal number, do you just let the first 64 bits represent the whole part and the second 64 bits represent the fractional part, or do you use a fancier format where you can fairly accurately represent numbers from ±1.0 × 10−28 to ±7.9 × 1028 as the Decimal in C# does? msdn.microsoft.com/en-us/library/364x0z75(VS.71).aspx
    – Job
    Mar 25, 2011 at 19:00
  • Essentially the difference between a using a fixed number of significant figures and a fixed number of decimal places
    – Henry
    Mar 25, 2011 at 23:23
  • 1
    The single most important practical difference is: never store monetary values in floating point. With money, absolute precision matters.
    – 9000
    Mar 26, 2011 at 9:53

8 Answers 8


There are two major differences between the two:

  • Binary format
  • Intended use

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 variable 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?

  • Almost forgot. Modern processors are very efficient at doing floating point math, so almost all calculations involving fractional numbers are done using floating point arithmetic. Fixed decimal numbers typically only are used when storing the number for later use. Mar 25, 2011 at 19:12
  • 2
    I'd rather say that floating point is variable precision, as absolute precision changes wildly with exponent. Fixed decimal numbers usually have fixed absolute precision.
    – 9000
    Mar 26, 2011 at 9:51
  • @9000, that is more accurate. I was struggling with how to express that sentiment, but then figured what I had was good enough for layman's terms. There are other libraries/languages that support arbitrary precision, but they are not using floating point numbers in computer science terms. Mar 26, 2011 at 12:24

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: 0000 0000 is 0 and 9999 9999 is 1 less than 100 million.

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 5000 0000 is equal to 0, 9999 9999 is just less than 50 million, and 0000 0000 is -50 million. We've regained the 80 million values (or precision) that were lost before, but now we can only get to a magnitude of +/- 50 million instead of the 100 million we started with.

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 500 000, so our precision is limited to +/-500 thousand, but our 2 magnitude characters allows us to span a range from -5e104 to just under +5e104. With numbers that big, who cares if you're off by 1 or 2, or 300? If you had $5e104 (500000 99) in your pocket and a $300 (000300 00)bill fell out, you'd never know it.

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 500000 00 represents the value 1/2 (.5). To represent the number 5 we use 500000 01 and to represent 500 trillion we use 500000 15. To represent PI, e, and the Avagadro constant we would use 314159 01, 271828 01 and 602214 24.

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 50 represents 0, 99 represents +49, and 00 represents -50. Now we can say that 1 Bohr is equal to 529177 38, or 5.29177e-11 meters.

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 300000 03 from 500000 99 or divide 543201 76 by 123977 06?

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 3141 5927 or e as 2718 2818. We have no way of tracking where the decimal point really is so we can't mix numbers that use a decimal after the first digit with numbers that use a decimal between the 4th and 5th digits. Besides not being able to mix where the decimal point is, the only thing that causes problems is adjusting where the decimal point should be after performing math.

If we use a fixed-point system with the decimal point between the 4th and 5th digits, then PI is represented as 0003 1416. Two times PI can be accomplished using simple integer addition as PI + PI (0003 1416 + 0003 1416 = 0006 2832), but what happens when we multiply PI (0003 1416) by 2 (0002 0000)? Using normal integer multiplication we end up with 628320000, which is too big to fit in our 8-character storage space. The simplest fix is to shift the digits to the right before multiplying--0003 1416 x 0002 0000 becomes 0000 0314 x 0000 0200 = 0006 2800. As you can see, we've just lost two digits of precision, so while this method does work, it doesn't work well. There are methods to overcome this that are still much faster than using floating point, so systems that do not implement floating point numbers can perform multiplication without losing precision.


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.


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):

Fixed-Point Fixed point numbers are a simple and easy way to express fractional numbers, using a fixed amount of bits. Systems without floating-point hardware support frequently use fixed-point numbers to represent fractional numbers.

The Decimal Point the term "Fixed-Point" refers to the decimal point of a number. In binary, bits can be either 0 or 1, and therefore we don't have a separate symbol to designate where the decimal point lies. However, we imagine, or assume, that the decimal point always sits at a certain location in the number. For instance, in a 32-bit number, we can assume that the decimal point exists directly between bits 15 (15 because the first bit is numbered 0, not 1) and 16, giving 16 bits of whole numbers, and 16 bits for the fractional part.

  • 1
    Please don't quote information from other sites without adding a link to the source.
    – Adam Lear
    Mar 25, 2011 at 19:12
  • @anna lear . sorry a bout that , will do next time . it was from Wikipedia.
    – walid
    Mar 26, 2011 at 22:06

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.


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.

  • There are two styles of decimal floating-point numbers: base-10 mantissa multiplied by a power of 10, and base-2 mantissa multiplied by a power of 10. The first form use to be more common; it would typically pack two base-10 numbers per byte, and popular microprocessors including the very first 4004 included hardware features to work with base-10 numbers (though base-10 integer- or fixed-point math was more common than floating-point). The latter form is more common today, and is exemplified by the .net Decimal type.
    – supercat
    Aug 15, 2012 at 17:36

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy