Talk:Double-precision floating-point format

WikiProject Computing (Rated Start-class)
This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start  This article has been rated as Start-Class on the project's quality scale.

Pros/Cons of Double Precision

This entry seems to be very technical explaining what Double Precision is, but not the benefits or applications of it.

I miss this too :/ Too bad I can't answer the question. -- Henriok 11:36, 8 January 2007 (UTC)

Um... pros: more digits of precision... cons: slower mathematical operations, takes more memory... ? Not too hard... Sdedeo (tips) 03:12, 10 September 2007 (UTC)

I don't think that was what they were asking. Given a fixed number of bits of precision "n", you could divide the interval over which you want to calculate in 2^n equal steps, this is integer arithmetic. Unfortunately it breaks down if the interval is not bounded or if both extremely large and extremely small values are expected and relative error is more important than absolute error. This means integers are unsuitable for a general purpose arithmetic (they are "bounded") and for many real world problems (where the relative error is most important). Now, you could save the logarithm of your values to solve this, but unfortunately adding and substracting numbers would become problematic. So double precision is essentially a hybrid approach. Shinobu (talk) 23:45, 13 December 2007 (UTC)
I think Gerbrant is reffering to the properties of floating point, not double precision in itself. (One can have double-precision integers). mfc (talk) 09:06, 22 December 2007 (UTC)
Its useful because computers are unable to store true Real numbers it can only store values of some arbitrary precision. So the computer can never truly store some values, for instance .1 or values like pi. So in application it allows for very small numbers to be represented in the computer, so for instance if you have some program that tracks the distance. And lets say you only care about like three zeros after the decimal place, then you could use floating points to store the values of the distance. (sorry to bring this topic back from the dead, I just wanted to give an example of when floating points would be use) Deadcellplus (talk) 21:41, 3 October 2008 (UTC)
Again, the question was most likely about double precision as compared to single precision, rather than floating point as compared to integer arithmetic. A lot of your explanation is also incorrect - for every number there is some encoding scheme that can finitely encode that value. The only true statement you can make is that no encoding scheme can encode an uncountable number of different real numbers, since the number of strings is countable. Floating-point arithmetic is useful because it's an encoding scheme designed to handle a wide range of real values frequently encountered in applications. Dcoetzee 00:46, 4 October 2008 (UTC)
Maybe my information is a bit outdated, but in the book I learned x86 assembly language from, there was a note that x87 FPUs internally always use 80-bit-precision; therefore there is no speed gain for smaller precision values, only memory storage benefits. Junkstar (talk) 09:44, 18 March 2013 (UTC)

Fractions

I can see the exponent and the sign, but which digits in the significand are used for the numbers before the decimal point, and which are used for after? —Preceding unsigned comment added by 67.91.121.114 (talk) 20:24, 20 May 2008 (UTC)

This is a good question - the short answer is, usually the position of the decimal point in the significand is fixed, so that it doesn't have to be encoded. In the IEEE encoding, the point is preceded by an implicit 1, also not encoded, and followed by the explicit bits of the significand. Underflow is a special case. Dcoetzee 00:54, 4 October 2008 (UTC)

Limitations

If "All bit patterns are valid encoding.", then why is the highest exponent represented by bits [000 0111 1111]? I tested sets of bits for higher values in Microsoft Visual Studio (C++) and got "infinite" as a value. It also turns out that comparing a double value to that "infinite" value throws an exception... But I guess this is more related to the compiler itself. —Preceding unsigned comment added by 69.70.33.68 (talk) 15:01, 19 March 2009 (UTC)

Infinity is a valid value. --193.71.114.235 (talk) 18:47, 10 February 2011 (UTC)

Integer resolution limits

I was looking for a mention about within what range all integers can be represented exactly. After some experimentation with double precision floats (52 bit stored fraction) it seems $2^{53}-1=9,007,199,254,740,991$ and $2^{53}=9,007,199,254,740,992$ are the largest positive integers where a difference of 1 can be represented. $2^{53}+1$ would be rounded up to $2^{53}+2$ [1].

1. ^ Calculations were made with converter at http://www.binaryconvert.com/result_double.html?decimal=057048048055049057057050053052055052048057057051
I added it.--Patrick (talk) 11:35, 8 October 2010 (UTC)
The article seems definitely wrong about this. It's obvious from the formula that the negative and positive resolutions are the same, but the article says that there's an extra bit of positive resolution. Where does it come from?
206.124.141.187 (talk) 18:00, 13 June 2014 (UTC)

17 digits used in examples

I'm confused, why do they use 17 digits in the examples if the prescribed number of digits is: 15.955 i.e. 1.7976931348623157 x 10^308 Also, an explanation of how you could have 15.955 digits would be nice. I'm assuming that the higher digits can't represent all values from 0-9 hence we can't get to a full 16 digits? — Preceding unsigned comment added by Ctataryn (talkcontribs) 22:45, 31 May 2011 (UTC)

You have 52 binary digits, which happens to be 15.955 decimal digits. Compared to 16 decimal digits, the last digit can't always represent all values from 0-9 (but in some cases it can, thus it represents 9.55 different values on average). Also, while on average you only have ~16 digits of precision, sometimes two different values have the same 16 digits, so you need a 17th digit to distinguish those. This means that for some values, you have 17 digits effective precision (while some others have only 15 digits precision). --94.219.122.21 (talk) 20:52, 7 February 2013 (UTC)

Execution speed - grammar

"calculations with double precision are 3 to 8 times slower than float."

What exactly does "x times slower" mean? Is it n^-x? Or n/x? How much would the logical conclusion of "1 time slower" be? This unscientific colloquial English is confusing and should be clarified. I would like to, but I cannot make sense of the source given. Thanks. Andersenman (talk) 10:52, 16 July 2014 (UTC)

x times slower is generally understood to mean it takes x times as long. Dicklyon (talk) 03:18, 4 December 2014 (UTC)