bug-parted
[Top][All Lists]
Advanced

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

Re: Parted 1.6.23 - problem with resizing of the extended partition


From: K.G.
Subject: Re: Parted 1.6.23 - problem with resizing of the extended partition
Date: Mon, 1 Aug 2005 10:25:55 +0200

On Mon, 1 Aug 2005 09:24:33 +0200 Vlado Potisk <address@hidden> wrote:
> > Again, I can't reproduce the problem from the numbers below.  I get
> > head_size = 63.  (I was typing in the formulas into python...)
> >
> > Perhaps the problem is that "float" doesn't have enough precision.
> > So, the first thing to try is replacing "float" with "double"
> > throughout probe_partition_for_geom().
> >
> 
> I did not change anything, just watched the variables.
> > You should get the following values:
> >
> >     ratio = 254.0
> >     X = -130671.0
> >     Y = -2099229615.0
> OK: 254.000000 -130671.000000 -2099229568.000000
> >     cyl_size = 16065.0
> I got one less - 16064 (file disk_dos.c, line #564: cyl_size = Y / X)
> >     head_size = 63.0
> head size is computed at line #575 as head_size = a_ - c * cyl_size) / h;
> (8305668 - 517 * 16064) / 1 = 580
> 
> Hope this will help.

This is exactly the problem i guessed in my previous mail.
There is an off by one error due to FP arith.

The equation system should be solved by something like 
        HR1 - hR2 => cyl_size = ( Ha_ - hA_ ) / (Hc - hC )

H being < 256 this can handle things up to 63-8 = 55 bits
in A. Let's say 54 to be safe cause i don't want to find
the exact value.

The precision of double is 53 bits so we don't loose anything,
and we avoid FP problems.

Cheers,
Guillaume Knispel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]