Anonymous user
Total circles area: Difference between revisions
Used INFINITY as in the second C entry, for uniformity + tags
(→{{header|C}}: reduce globals; speed; cropped data list) |
(Used INFINITY as in the second C entry, for uniformity + tags) |
||
Line 46:
=={{header|C}}==
===C: Montecarlo Sampling===
This program uses a Montecarlo sampling. For this problem this is less efficient (converges more slowly) than a regular grid sampling, like in the Python entry.
<lang c>#include <stdio.h>
Line 106 ⟶ 107:
int main() {
// Initialize the bounding box (bbox) of the circles.
Fp x_min =
Fp y_min = x_min, y_max = x_max;
Line 163 ⟶ 164:
21.5637 +/- 0.0003 (1073741824 samples)</pre>
===C: Scanline Method===
<lang c>#include <stdio.h>
#include <math.h>
|