From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4804 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 22:50:10 -0400 Message-ID: <20140405025010.GA3774@brightrain.aerifal.cx> References: <20140404141515.GD3034@port70.net> <20140404150705.GN26358@brightrain.aerifal.cx> <20140404185413.GH3034@port70.net> <20140404210207.GR26358@brightrain.aerifal.cx> 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 1396666230 27314 80.91.229.3 (5 Apr 2014 02:50:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2014 02:50:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4808-gllmg-musl=m.gmane.org@lists.openwall.com Sat Apr 05 04:50:24 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 1WWGgZ-0007mH-M9 for gllmg-musl@plane.gmane.org; Sat, 05 Apr 2014 04:50:23 +0200 Original-Received: (qmail 22259 invoked by uid 550); 5 Apr 2014 02:50:23 -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 22251 invoked from network); 5 Apr 2014 02:50:22 -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:4804 Archived-At: On Fri, Apr 04, 2014 at 10:08:47PM -0400, Morten Welinder wrote: > > [...] excess precision (FLT_EVAL_METHOD==2). This is why > > musl uses long double internally everywhere that rounding semantics > > matter. > > That's what I thought, but it's not actually what I see over in src/math/. I guess I should elaborate that I meant everywhere in the code that I wrote, which doesn't include anything in src/math except asm. > If I look in src/math/floor.c I see an explicit cast from double to double > used to get rid of excess precision. The similar thing ought to work in > fmt_fp. Yes, I think this works, but it's fairly fragile under the possibility of compiler bugs. FWIW, floor, etc. all have asm versions on i386 so the excess precision issue doesn't come into play unless you go out of your way to remove the asm. (This reminds me -- I want to eventually separate mandatory asm from optimization asm, to make it easier to test C code that would otherwise be shadowed by asm.) Rich