正在加载图片...
20.6 Arithmetic at Arbitrary Precision 923 3.1415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 204665213841469519415116094330572703657595919530921861173819326117931051185 480744623799627495673518857527248912279381830119491298336733624406566430860 21394946395224737190702179860943702770539217176293176752384674818467669405】 320005681271452635608277857713427577896091736371787214684409012249534301465 495853710507922796892589235420199561121290219608640344181598136297747713099 605187072113499999983729780499510597317328160963185950244594553469083026425 223082533446850352619311881710100031378387528865875332083814206171776691473 Permission is 035982534904287554687311595628638823537875937519577818577805321712268066130 019278766111959092164201989380952572010654858632788659361533818279682303019 520353018529689957736225994138912497217752834791315155748572424541506959508 83 295331168617278558890750983817546374649393192550604009277016711390098488240 128583616035637076601047101819429555961989467678374494482553797747268471040 granted for 475346462080466842590694912933136770289891521047521620569660240580381501935 112533824300355876402474964732639141992726042699227967823547816360093417216 412199245863150302861829745557067498385054945885869269956909272107975093029 11-800-872 (including this one) 553211653449872027559602364806654991198818347977535663698074265425278625518 184175746728909777727938000816470600161452491921732172147723501414419735685 7423 from NUMERICAL RECIPES IN 481613611573525521334757418494684385233239073941433345477624168625189835694 855620992192221842725502542568876717904946016534668049886272327917860857843 838279679766814541009538837863609506800642251252051173929848960841284886269 456042419652850222106611863067442786220391949450471237137869609563643719172 874677646575739624138908658326459958133904780275900994657640789512694683983 (North America to any server computer, tusers to make one paper 1988-1992 by Cambridge University Press.Programs THE 525957098258226205224894077267194782684826014769909026401363944374553050682 034962524517493996514314298091906592509372216964615157098583874105978859597 是 ART 729754989301617539284681382686838689427741559918559252459539594310499725246 808459872736446958486538367362226260991246080512438843904512441365497627807 977156914359977001296160894416948685558484063534220722258284886481584560285 Figure 20.6.1.The first 2398 decimal digits of computed by the routines in this section. Copyright (C) #include <stdio.h> to dir #include "nrutil.h" #define IAOFF 48 ectcustser OF SCIENTIFIC COMPUTING(ISBN void mppi(int n) 18881920 Demonstrate multiple precision routines by calculating and printing the first n bytes of r. v@cam void mp2dfr(unsigned char a[],unsigned char s[],int n,int *m); 10-621 void mpadd(unsigned char w[],unsigned char u[],unsigned char v[],int n); void mpinv(unsigned char u[],unsigned char v[],int n,int m); void mplsh(unsigned char u[],int n); Numerical Recipes -43108 void mpmov(unsigned char u[],unsigned char v[],int n); void mpmul(unsigned char w[],unsigned char u[],unsigned char v],int n, int m); (outside void mpsdv(unsigned char w[],unsigned char u[],int n,int iv,int *ir); North Software. void mpsqrt(unsigned char w[],unsigned char u[],unsigned char v[],int n, int m); int ir,j,mi Ame unsigned char mm,*X,*y,*sX,*SX1,*t,*s,*P1; x=cvector(1,n+1); y=cvector(1,n<<1); sx=cvector(1.n); sxi=cvector(1,n); t=cvector(1,n<<1); s=cvector(1,3*n); pi=cvector(1,n+1); t[1]=2; Set T=2. for(j=2:j<n;j++)t[j门=0;20.6 Arithmetic at Arbitrary Precision 923 Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). 3.1415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 204665213841469519415116094330572703657595919530921861173819326117931051185 480744623799627495673518857527248912279381830119491298336733624406566430860 213949463952247371907021798609437027705392171762931767523846748184676694051 320005681271452635608277857713427577896091736371787214684409012249534301465 495853710507922796892589235420199561121290219608640344181598136297747713099 605187072113499999983729780499510597317328160963185950244594553469083026425 223082533446850352619311881710100031378387528865875332083814206171776691473 035982534904287554687311595628638823537875937519577818577805321712268066130 019278766111959092164201989380952572010654858632788659361533818279682303019 520353018529689957736225994138912497217752834791315155748572424541506959508 295331168617278558890750983817546374649393192550604009277016711390098488240 128583616035637076601047101819429555961989467678374494482553797747268471040 475346462080466842590694912933136770289891521047521620569660240580381501935 112533824300355876402474964732639141992726042699227967823547816360093417216 412199245863150302861829745557067498385054945885869269956909272107975093029 553211653449872027559602364806654991198818347977535663698074265425278625518 184175746728909777727938000816470600161452491921732172147723501414419735685 481613611573525521334757418494684385233239073941433345477624168625189835694 855620992192221842725502542568876717904946016534668049886272327917860857843 838279679766814541009538837863609506800642251252051173929848960841284886269 456042419652850222106611863067442786220391949450471237137869609563643719172 874677646575739624138908658326459958133904780275900994657640789512694683983 525957098258226205224894077267194782684826014769909026401363944374553050682 034962524517493996514314298091906592509372216964615157098583874105978859597 729754989301617539284681382686838689427741559918559252459539594310499725246 808459872736446958486538367362226260991246080512438843904512441365497627807 977156914359977001296160894416948685558484063534220722258284886481584560285 Figure 20.6.1. The first 2398 decimal digits of π, computed by the routines in this section. #include <stdio.h> #include "nrutil.h" #define IAOFF 48 void mppi(int n) Demonstrate multiple precision routines by calculating and printing the first n bytes of π. { void mp2dfr(unsigned char a[], unsigned char s[], int n, int *m); void mpadd(unsigned char w[], unsigned char u[], unsigned char v[], int n); void mpinv(unsigned char u[], unsigned char v[], int n, int m); void mplsh(unsigned char u[], int n); void mpmov(unsigned char u[], unsigned char v[], int n); void mpmul(unsigned char w[], unsigned char u[], unsigned char v[], int n, int m); void mpsdv(unsigned char w[], unsigned char u[], int n, int iv, int *ir); void mpsqrt(unsigned char w[], unsigned char u[], unsigned char v[], int n, int m); int ir,j,m; unsigned char mm,*x,*y,*sx,*sxi,*t,*s,*pi; x=cvector(1,n+1); y=cvector(1,n<<1); sx=cvector(1,n); sxi=cvector(1,n); t=cvector(1,n<<1); s=cvector(1,3*n); pi=cvector(1,n+1); t[1]=2; Set T = 2. for (j=2;j<=n;j++) t[j]=0;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有