1
1
mirror of https://github.com/foxsen/archbase.git synced 2026-04-26 11:30:09 +08:00

initial import to public repository

This commit is contained in:
Zhang Fuxin
2021-10-27 19:14:51 +08:00
commit c632bed67e
362 changed files with 53748 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#include <stdio.h>
#include <omp.h>
int main(){
int i;
int num_steps=1000000;
double x,pi,step,sum=0.0;
step = 1.0/(double) num_steps;
#pragma omp parallel for private(i, x), reduction(+:sum)
for(i=0;i<num_steps;i++)
{
x=(i+0.5)*step;
sum = sum+4.0/(1.0+x*x);
}
pi = step*sum;
printf("pi %1f\n", pi);
return 0;
}