From owner-freebsd-current@FreeBSD.ORG Wed Jan 29 22:23:30 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A2B2A870 for ; Wed, 29 Jan 2014 22:23:30 +0000 (UTC) Received: from smtpout6.timeweb.ru (smtpout6.timeweb.ru [92.53.117.39]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 572E81CFA for ; Wed, 29 Jan 2014 22:23:30 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1W8dXZ-0000WT-UT; Thu, 30 Jan 2014 02:23:25 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 8C8D4FFA; Thu, 30 Jan 2014 02:23:25 +0400 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 75EDB72A5; Thu, 30 Jan 2014 02:23:25 +0400 (MSK) Date: Thu, 30 Jan 2014 02:23:25 +0400 From: Dmitry Marakasov To: Steve Kargl Subject: Re: libm lacks C99 functions -> no c++11 cmath in libstdc++ Message-ID: <20140129222325.GA9806@hades.panopticon> References: <20140129164136.GA3489@hades.panopticon> <20140129172307.GA88757@troutmask.apl.washington.edu> <20140129184735.GA63095@hades.panopticon> <20140129215928.GA89714@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20140129215928.GA89714@troutmask.apl.washington.edu> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: freebsd-current@FreeBSD.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jan 2014 22:23:30 -0000 * Steve Kargl (sgk@troutmask.apl.washington.edu) wrote: > > > > - bad enough by itself, it affects libstdc++ from ports' gcc in such a > > > > way that it disables C++11 math completely (along with a lot more > > > > other more widely used math functions) > > > > > > > > > > > > - we may probably implement these by calling less-precise > > > > erf erfc lgamma tgamma as we do with other functions as we alredy > > > > do with some others > > > > > > This, unfortuantely, has already been done, although it may only > > > be available in FreeBSD-current. See src/lib/msun/src/imprecise.c. > > > > I know, it's available on 10.0 as well. However that's not the case for > > 9.x, for which it's impossible to build c++11 math using software (even > > if it doesn't use unimplemented functions), neither with system gcc > > nor with gcc from ports. > > > > It's not impossible. Add whatever C++-fu you need > that is equivalent to > > #include > #ifndef fool > #define fool(x) foo((double)(x)) > #endif The point was that one should not be required to do something like this to build std::hypot - using software on FreeBSD. --- +#define _GLIBCXX_USE_C99_MATH_TR1 +#include +long double erfl(long double x) { return erf(x); } +long double erfcl(long double x) { return erfc(x); } +long double lgammal(long double x) { return lgamma(x); } +long double tgammal(long double x) { return tgamma(x); } + #include int main() { std::hypot(3.0, 4.0); } --- -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru