[poppler] PDF to PPM: Page height differs between 32bit and 64bit systems

William Bader williambader at hotmail.com
Wed May 14 21:46:28 PDT 2014


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: 7FdqWGq4fE8x at dyweni.com
> To: cloos at jhcloos.com
> CC: poppler at lists.freedesktop.org
> 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 <cloos at jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20140515/0949a146/attachment.html>


More information about the poppler mailing list