Re: libm lacks C99 functions -> no c++11 cmath in libstdc++

看板FB_current作者時間12年前 (2014/01/30 06:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/6 (看更多)
* 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 <math.h> > #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 <math.h> +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 <cmath> 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 _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1IwO5Zhm (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1IwO5Zhm (FB_current)