From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4793 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf issues Date: Fri, 4 Apr 2014 17:02:07 -0400 Message-ID: <20140404210207.GR26358@brightrain.aerifal.cx> References: <20140404141515.GD3034@port70.net> <20140404150705.GN26358@brightrain.aerifal.cx> <20140404185413.GH3034@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1396645354 16571 80.91.229.3 (4 Apr 2014 21:02:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2014 21:02:34 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4797-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 04 23:02:28 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WWBFq-0004l5-0M for gllmg-musl@plane.gmane.org; Fri, 04 Apr 2014 23:02:26 +0200 Original-Received: (qmail 31775 invoked by uid 550); 4 Apr 2014 21:02:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31764 invoked from network); 4 Apr 2014 21:02:19 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4793 Archived-At: On Fri, Apr 04, 2014 at 04:01:08PM -0400, Morten Welinder wrote: > 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? > > 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, https://bugs.kde.org/show_bug.cgi?id=164298) This is a known issue that needs to be fixed in valgrind. It's impossible to do anything useful with rounding on x86 with types other than double, due to excess precision (FLT_EVAL_METHOD==2). This is why musl uses long double internally everywhere that rounding semantics matter. Rich