[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#632031: convert: gray colorspace creates broken postscript



On Wed, Jun 29, 2011 at 4:51 PM, Christoph Nodes <nodes@bfw-online.de> wrote:
> On Wed, 29 Jun 2011 15:37:08 +0200
> Bastien ROUCARIES <roucaries.bastien@gmail.com> wrote:
>
>> Could you post also the printf patch and the rational for this patch ?

Do you know this bug?
http://sourceware.org/bugzilla/show_bug.cgi?id=5044

You could get the correct version without using your hack by doing
fesetround(mode)
and after using directly printf

Ok so the imagemagick method ok getting integer will not work if you
use fesetround

Bastien

>
> The reason for this patch is to deal better (for our concerns, i.e.
> printing of amounts) with the rounded printing of non-representable
> floating point numbers.
>
> You would expect
>
> $ printf '%.2f\n' 0.355
>
> to print 0.36 but it does print 0.35. This is because 0.355 is not
> representable as IEEE 754 floating point number and is rounded to the
> next representable number (0.3549999...) before passing it as parameter
> to printf.
>
> The patch causes printf to take the next greater representable
> floating point number of every passed floating point parameter and use
> that for the output. This has proven to produce better results for us.
>
>
> Best regards,
> Christoph
>
>
>



Reply to: