Skip to content

Repository files navigation

採用離散積分的方法求圓周率,並著手透過 SIMD 指令作效能最佳化

Authored by Lee Chao Yuan <charles620016@gmail.com>

相關連結

Baseline 版本

doublecomputePi_v1(size_tN)
{
doublepi=0.0;
doubledt=1.0 / N; // dt = (b-a)/N, b = 1, a = 0for (size_ti=0; i<N; i++) {
doublex= (double) i / N; // x = ti = a+(b-a)*i/N = i/Npi+=dt / (1.0+x*x); // integrate 1/(1+x^2), i = 0....N
}
returnpi*4.0;
}

Benchmarking

About

Leibniz formula for π

Resources

Stars

13 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages