Don <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #2 from Don <> 2012-06-22 00:16:57 PDT ---
Re idea 5:

To find number of digits of x, use
p = x.ulonglength();
m = peekUlong(p-1);

then number of digits is between
lowerbound = log10(m) + p*log10(ulong.sizeof*8*2).
upperbound = log10(m+1) + p*log10(ulong.sizeof*8*2)

Make sure that there are enough digits in m that 
(upperbound-lowerbound) < 1.

Optionally use m = m*(ulong+1) + peekUlong(p-2), p-- 
to get a better value for m, which will reduce the probability that an exact
calculation must be performed.

If the range includes an exact integer (eg, the range is 1547.8 .. 1548.2) then
it's necessary to do a full calculation.

if (trunc(lowerbound) == trunc(upperbound)) return lowerbound
    y = 10^^(lowerbound+1);
    if (x < y) return lowerbound;
    return lowerbound+1;
The problem is, that if the number is close to 10^^d, there is no way to avoid
the full calculation. And unfortunately, although the hard case it is
numerically rare, it is a very common case in practice.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to