<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Will truncating it to float always round in the right direction?<div><br></div><div>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?<br><br><div>> Date: Wed, 14 May 2014 22:36:40 -0500<br>> From: 7FdqWGq4fE8x@dyweni.com<br>> To: cloos@jhcloos.com<br>> CC: poppler@lists.freedesktop.org<br>> Subject: Re: [poppler] PDF to PPM: Page height differs between 32bit and 64bit systems<br>> <br>> <br>> <br>> On 2014-05-14 17:15, James Cloos wrote:<br>> > <br>> > If you replace:<br>> > <br>> > h = (int)ceil(pg_h)<br>> > <br>> > with:<br>> > <br>> > h = (int)ceilf((float)pg_h)<br>> > <br>> > it should avoid the rounding bug.<br>> > <br>> > (pg_w should get the same treatment.)<br>> > <br>> <br>> <br>> Yes, this works for both pg_w and pg_h.<br>> <br>> <br>> <br>> <br>> > Or perhaps pg_h and pg_w should get a (double)(float) treatment earlier<br>> > in the code.<br>> > <br>> > A more accurate treatment would round fewer of the least significant<br>> > bits, but casting to float and back still leaves 24 bits of resolution.<br>> > <br>> > -JimC<br>> > --<br>> > James Cloos <cloos@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6<br>> _______________________________________________<br>> poppler mailing list<br>> poppler@lists.freedesktop.org<br>> http://lists.freedesktop.org/mailman/listinfo/poppler<br></div></div> </div></body>
</html>