Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 4 Apr 2014 22:54:12 +0200
From: Szabolcs Nagy <>
Subject: Re: printf issues

* Morten Welinder <> [2014-04-04 16:01:08 -0400]:
> In fmt_fmt, the rounding decision is done using this test:
>             /* Decide whether to round by probing round+small */
>             if (round+small != round) { ...
> Why is this done with long double?

to support FLT_EVAL_METHOD==2 (for i386 on gcc without sse)

this means that all fp arithmetics is evaluated at long double precision
on the fpu and even if we use different types or cast we have to take
care of excess precision related issues (double-rounding, and various
bugs in older gcc) which may or may not be easy

in this case it seems to me that single precision float can be used
there, we just have to make sure that the excess precision is rounded
away correctly before the round+small != round comparision

> The reason I ask is that the Valgrind situation improves a lot if
> this is done with doubles.
> (Valgrind situation: Valgrind emulates long doubles, poorly, by using
> simple doubles.  See, for example,

yes, that is known and unfortunate limitation, it's in their manual:

we cannot do much about it: with such broken arithmetics
arbitrarily bad things can happen even if we remove
long doubles from the printf code

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.