MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / pi_host

Function pi_host

examples/benchmarks/pi.cpp:35–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35static double pi_host() {
36 int count = 0;
37 for (int i = 0; i < samples; ++i) {
38 float x = float(rand()) / float(RAND_MAX);
39 float y = float(rand()) / float(RAND_MAX);
40 if (sqrt(x * x + y * y) < 1) count++;
41 }
42 return 4.0 * count / samples;
43}
44
45// void wrappers for timeit()
46static void device_wrapper() { pi_device(); }

Callers 2

host_wrapperFunction · 0.85
mainFunction · 0.85

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected