Re: Use of C99 extra long double math functions after r236148

看板FB_current作者時間13年前 (2012/07/26 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串97/100 (看更多)
On 07/25/12 11:29, Rainer Hurling wrote: > Many thanks to you three for implementing expl() with r238722 and r238724. > > I am not a C programmer, but would like to ask if the following example > is correct and suituable as a minimalistic test of this new C99 function? > > > //----------------------------------- > #include <stdio.h> > #include <math.h> > > int main(void) > { > double c = 2.0; > long double d = 2.0; > > double e = exp(c); > long double f = expl(d); > > printf("exp(%f) is %.*f\n", c, 90, e); > printf("expl(%Lf) is %.*Lf\n", d, 90, f); > > return 0; > } > //----------------------------------- > > > Compiled with 'c99 -o math_expl math_expl.c -lm' and running afterwards > it gives me: > > exp(2.000000) is > 7.389056098930650406941822438966482877731323242187500000000000000000000000000000000000000000 > > expl(2.000000) is > 7.389056098930650227397942675366948606097139418125152587890625000000000000000000000000000000 > Just as a point of comparison, here is the answer computed using Mathematica: N[Exp[2], 50] 7.3890560989306502272304274605750078131803155705518 As you can see, the expl solution has only a few digits more accuracy that exp. _______________________________________________ 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): #1G43HV4w (FB_current)
討論串 (同標題文章)
完整討論串 (本文為第 97 之 100 篇):
文章代碼(AID): #1G43HV4w (FB_current)