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 = 1/0.0INFINITY, x_max = -1/0.0INFINITY;
Fp y_min = x_min, y_max = x_max;
 
Line 163 ⟶ 164:
21.5637 +/- 0.0003 (1073741824 samples)</pre>
 
===C: Scanline Method===
ScanlineThis method.version Doesperforms about 5 million-ish scanlines in about a second, result should be accurate to maybe 10 decimal points.
<lang c>#include <stdio.h>
#include <math.h>