From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/638 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: libm Date: Fri, 9 Mar 2012 12:02:54 -0500 Message-ID: <20120309170254.GG184@brightrain.aerifal.cx> References: <20120303225758.GA5728@port70.net> <20120304065340.GT184@brightrain.aerifal.cx> <20120304145041.GB5728@port70.net> <20120304184339.GV184@brightrain.aerifal.cx> <20120305085135.GC5728@port70.net> <20120305140459.GW184@brightrain.aerifal.cx> <20120305151710.GG5728@port70.net> <20120309102239.GC184@brightrain.aerifal.cx> <20120309110946.GU5728@port70.net> <20120309155655.GD184@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: dough.gmane.org 1331312615 8184 80.91.229.3 (9 Mar 2012 17:03:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2012 17:03:35 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-639-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 09 18:03:32 2012 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 1S63E0-0006LU-90 for gllmg-musl@plane.gmane.org; Fri, 09 Mar 2012 18:03:28 +0100 Original-Received: (qmail 27991 invoked by uid 550); 9 Mar 2012 17:03:26 -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 27926 invoked from network); 9 Mar 2012 17:03:11 -0000 Content-Disposition: inline In-Reply-To: <20120309155655.GD184@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:638 Archived-At: On Fri, Mar 09, 2012 at 10:56:55AM -0500, Rich Felker wrote: > > > Then add __RETCAST((x)), __RETCAST((x)+(y)), etc. Some trick will be > > > needed to make integer types result in a cast to double, though. > > > > hm the int->double and complex/real cases are tricky > > > > i thought +1.0 or +I would solve these, but that's wrong > > I think +0.0f might solve it. Isn't the promoted type of any integer > type with float double? Nope, it results in float. glibc has a trick involving obscure interactions of null pointer constants and the ?: operator that generates the right type using __typeof__, which is no big deal because this code is already only used when __typeof__ is available, anyway. There's a good blog article on it somewhere which I can't seem to find at the moment... Rich