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

James Cloos cloos at jhcloos.com
Wed May 14 11:31:59 PDT 2014


>>>>> "D" == Dyweni  <- Poppler <7FdqWGq4fE8x at dyweni.com>> writes:

D> Hi,
D> I've traced the problem back to line 501 in the same file 'pg_h = pg_h
D> * (y_resolution / 72.0);'

The %a option in printf(3) would be useful, too.

Rather than 32bit vs 64bit, this is likely a '387 vs ieee754 issue.

The fp math on the 387 was done with 64bit significand for any input,
and the modern x86 processors emulate that when using the 387 instructions.

Anything doing the calculations on _Float64 (52+1 bit significand) will
see more rounding issues.

I'd expect all non-x86 systems to agree with your 64bit results,
notwithstanding whether they are 32- or 64-bit.

Given the higher internal precision of the 387 calculations, it is
reasonably to presume tha 1650 is the more accurate result.  Which
implies that something more complicated than ceil() is desired.

Feeding those printf("%.64f", ...)) results into printf(1), I get
0xc.e4p+7 vs 0xc.e400000000008p+7.

For a _Float64 that is a difference of the least significant bit.

Maybe casting the double to a float and using ceilf(3) would be the
right solution?

-JimC
--
James Cloos <cloos at jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6




More information about the poppler mailing list