How to interrogate optical discs

Richard Shaw hobbes1069 at gmail.com
Wed Jun 16 13:29:45 UTC 2010


On Wed, Jun 16, 2010 at 7:59 AM, Bruno Wolff III <bruno at wolff.to> wrote:
> On Tue, Jun 15, 2010 at 20:38:56 -0500,
>  Richard Shaw <hobbes1069 at gmail.com> wrote:
>> 3        iso_size = math.ceil(file_size/(2*1024))*2*1024
>
> With loose typing the about might be doing the division as integer division.
> One possible fix would be:
> iso_size = ((file_size + ((2*1024)-1))/(2*1024))*(2*1024)

I eventually came to the same conclusion last night, I changed that
line to the following:

iso_size = math.ceil(file_size/(2.0**11))*(2.0**11)

The "2.0" trips it over to floating point math, but I didn't see any
significant difference in the disc_size calculation.

Richard


More information about the users mailing list