实验4 pi 的计算(7)
发布时间:2021-06-08
发布时间:2021-06-08
并行计算的pi的多种计算方法的实验
}
double t(int a)
{
}
int _tmain(intargc, char* argv[])
{
int done = 0, n, myid, numprocs, i,source=0,count=1; double PI25DT = 3.141592653589793238462643;
doublemypi, pi, h, sum, x, sum2;
doublestartwtime = 0.0, endwtime;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
while (!done)
{ { if (myid == source)
fprintf(stdout, "Enter the number of intervals: (0 quits) "); int b=(int)a; doublenum; double sum=0.0; { num=1+2*a; } else{ num=1+2*a; sum=pow(239.0,num); return (-1.0/(num*sum));} sum=pow(239.0,num); return (1.0/(num*sum)); { num=1+2*a; } else{ num=1+2*a; sum=pow(5.0,num); return (-4.0/(num*sum));} sum=pow(5.0,num); return (4.0/(num*sum)); if(b%2==0)
上一篇:1管理沟通概述