Friday, 15 March 2013

floating point - Maximum number of decimal digits that can affect a double -


form d1.d2d3d4d5 ... consider the decimal presentation of dnExxx where xxx is an arbitrary exponent and both D1 and DN .

What is the maximum known that there is a decimal representation d1.d2d3d4d5 ... dnExxx such that the interval (d1.d2d3d4d5 ... dnExxx, d1.d2d3d4d5 ... ((DN) +1) Exxx ) Is an IEEE 754 double?

n must be at least 17 How much above question 17 is.

This is something to do with the number n number, it is enough to consider double to decimal from the decimal such as strtod () in comparison to the digits. I saw the source code for the hope to find an answer there. There is an indication, "â 40-40" but it is not clear whether it is a result of a sound mathematical result or just statistically safe. Also about a comment - truncatingâ ???? It makes sound like 0.5 billion billion billion dollars, in round-up mode can be converted to 0.5.

Read about 125 * 9 points, which is a lot. Then it switches to a sticky ???? Mode:

  if (c! = '0') x [KMAX-4] | = 1;   

Finally, how does the answer change at the time of replacement? Is IEEE 754 double? Together, there is a mid point of two consecutive IEEE 754 doubles

When you have an unusual with odd significance The number is, that is a strange multiple of 2 ^ (- 1074) , you have a number whose final noose number 1074 th in decimal representation after the decimal point After that you have approximately 300 zeros, which follow the decimal point, hence the number is around 750-770 decimal digits. The least positive abnormal, 2 ^ (- 1074) has 751 important digits, and the largest positive abnormal, (2 ^ 52-1) * 2 ^ (- 1074) 767 are important points (I think the maximum is).

Therefore, at least one sequence of decimal digits is d1, ..., d766 such that an IEEE 754 double in open interval >

  (d1.d2 ... d766E-308, d1.d2 ... (d766 + 1) e-308)   

If we ask for "two consecutive IEEE If you look at the middle point of 754 double s, then the answer does not change much because the abnormal double s is roughly the same amount of decimal decimals, and two consecutive Kind of midpoint too

In the worst case, the whole number sequence should be used ( "0.5000000 ... 0001" / code> determines, with arbitrarily multiple zeros before the last 1 That result will not be the result of 0.5 + 0.5 ^ 53 and 0.5 while traveling from zero or above. / P>

However, only

  Floor (DBL_MANT_DIG * log2 / log 10) + 2 = 17   

Important distinguishing decimal points are required to differentiate between different dual values , Maybe a relatively The easiest, although probably not very efficient, the parsing method must first (at least 17) digits (and exponents) be parsed to the nearest double , and that double value (and its neighbors).

No comments:

Post a Comment