Will truncating it to float always round in the right direction? Would it be safer or more machine independent to use something like h = (int)ceil( pg_h - epsilon ) where epsilon is 1e-4 or 1e-5?
> Date: Wed, 14 May 2014 22:36:40 -0500 > From: [email protected] > To: [email protected] > CC: [email protected] > Subject: Re: [poppler] PDF to PPM: Page height differs between 32bit and > 64bit systems > > > > On 2014-05-14 17:15, James Cloos wrote: > > > > If you replace: > > > > h = (int)ceil(pg_h) > > > > with: > > > > h = (int)ceilf((float)pg_h) > > > > it should avoid the rounding bug. > > > > (pg_w should get the same treatment.) > > > > > Yes, this works for both pg_w and pg_h. > > > > > > Or perhaps pg_h and pg_w should get a (double)(float) treatment earlier > > in the code. > > > > A more accurate treatment would round fewer of the least significant > > bits, but casting to float and back still leaves 24 bits of resolution. > > > > -JimC > > -- > > James Cloos <[email protected]> OpenPGP: 0x997A9F17ED7DAEA6 > _______________________________________________ > poppler mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/poppler
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
