[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: e2fsck hanging



On Tue, Mar 20, 2007 at 09:44:07AM -0400, Richard Jackson wrote:
> There are are few issues with the get_icount_el() code.  First a simple
> binary search may be sufficient.  Also, We now know the float type is
> not sufficient to handle the large or small values handled by this
> code.  One problem with using float is it does not have the precision
> to divide two sufficently large numbers with a small enough
> difference.  The other issue is with float value approximation that
> causes 'mid' to be larger than 'high'.  The approximation is due to
> float single-precision 23 bit mantissa.  Values up to integer
> 16,777,215 are handled as expected but starting at 16,777,216 the least
> significant bits are truncated producing an approximation.  The
> approximation could be more or less than what is expected.  This is a
> feature of using float.  Double type for IEEE 754 double-precision 64
> bit provides a 52 bit mantissa to play with.  That is a large number.

Well, keep in mind that the float is just as an optimization to doing
a simple binary search.  So it doesn't have to be precise; an
approximation is fine, except when mid ends up being larger than high.
But it's simple enough to catch that particular case where the
division going to 1 instead of 0.99999 as we might expect.  Catching
that should be enough, I expect.

						- Ted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]