From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/631 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: libm Date: Fri, 9 Mar 2012 05:22:39 -0500 Message-ID: <20120309102239.GC184@brightrain.aerifal.cx> References: <20120123170715.GA197@brightrain.aerifal.cx> <20120227210253.GA25004@port70.net> <20120227222437.GH184@brightrain.aerifal.cx> <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> 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 1331288582 11577 80.91.229.3 (9 Mar 2012 10:23:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2012 10:23:02 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-632-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 09 11:22:59 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 1S5wyQ-0008RP-5k for gllmg-musl@plane.gmane.org; Fri, 09 Mar 2012 11:22:58 +0100 Original-Received: (qmail 26314 invoked by uid 550); 9 Mar 2012 10:22:57 -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 26306 invoked from network); 9 Mar 2012 10:22:57 -0000 Content-Disposition: inline In-Reply-To: <20120305151710.GG5728@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:631 Archived-At: On Mon, Mar 05, 2012 at 04:17:11PM +0100, Szabolcs Nagy wrote: > * Rich Felker [2012-03-05 09:04:59 -0500]: > > On Mon, Mar 05, 2012 at 09:51:35AM +0100, Szabolcs Nagy wrote: > > Hm? If you need a macro to test whether an argument is an integer or > > floating point, try this: > > > > #define __IS_FP(x) !!((1?1:(x))/2) > > > > oh nice > (and subtle) I checked out your latest tgmath.h; it's surprisingly clean and readable! A couple ideas.. 1. __fun could be just fun (macro arguments are free of namespace issues) 2. You could add something like: #ifdef __GNUC__ #define __RETCAST(x) (__typeof__((x)) #else #define __RETCAST(x) #endif Then add __RETCAST((x)), __RETCAST((x)+(y)), etc. Some trick will be needed to make integer types result in a cast to double, though. Rich