we have a bug at debian using an high precision printf see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632065
You output double instead of int for pages and bounding box field (at least on ps.c, but i have not checked ps3 and pdf)
Please also notice that if you use %i and cast to int, that you need to create positive length bounding box so use ceil and floor in order to enforce this.
Bastien
Output double instead of int in postscript code
-
- Posts: 467
- Joined: 2008-12-21T11:51:10-07:00
Re: Output double instead of int in postscript code
We consistently use %.20g and cast any value to double for printf statements. We conveniently get integers when the value is integer, floats for non-integer values, and scientific notation when the values get larger. The primary benefit is that ImageMagick includes many 64-bit values and %.20g typically handles these gracefully under Linux, Mac, and Windows. That is, we don't need to conditionally compile different embedded formatting to support 64-bit values (one way under Linux, a different way under Windows). However, you are suggesting that the %.20g fails under Debian for a 64-bit integer value and instead produces a floating point value? Can you post the Pages line of the file produced with
Sure we can change this one statement to use %i instead but we would need to make this sort of formatting change in about 100 places in ImageMagick. And as mentioned we would need to use different embedded printf formatting for Linux and Windows to support 64-bit integer values.
- convert rose: -colorspace Gray test.ps
Code: Select all
(void) FormatLocaleString(buffer,MaxTextExtent,"%%%%Pages: %.20g\n",
image_info->adjoin != MagickFalse ? (double)
GetImageListLength(image) : 1.0);
-
- Posts: 467
- Joined: 2008-12-21T11:51:10-07:00
Re: Output double instead of int in postscript code
The user use a non compliant IEEE754 float. You could close your bug if you support imagemagick only on IEE754
-
- Posts: 467
- Joined: 2008-12-21T11:51:10-07:00
Re: Output double instead of int in postscript code
BTW for compatibility over all OS see gnulib http://www.gnu.org/software/gnulib/manu ... rintf.html
It has some nice lgpl code and as a source library could be included in your source
It has some nice lgpl code and as a source library could be included in your source