Anonymous user
Total circles area: Difference between revisions
m
→{{header|REXX}}: changed output units to number of points instead of number of boxes.
m (→optimized: added an output for over ¼ billion points.) |
m (→{{header|REXX}}: changed output units to number of points instead of number of boxes.) |
||
Line 1,664:
end /*row*/
/*stick a fork in it, we're done.*/
say 'The approximate area is: ' #*dx*dy " using" box
'''outputs''' when using the default input:
<pre>
The approximate area is: 21.5615597720034 using
</pre>
Line 1,674:
<br>Also, another optimization is the sorting of the circles by (descending) radii,
<br>this reduces the computation time (for overlapping circles) by around 25%.
<br>This, with other optimizations, makes this 2<sup>nd</sup> version about twice as fast as the 1<sup>st</sup>.
This version also has additional information displayed.
Line 1,757 ⟶ 1,758:
end /*row*/
say
say 'The approximate area is: ' #*dx*dy " using" box**2 "
/*stick a fork in it, we're done.*/</lang>
'''output''' using various number of boxes:
Line 1,775 ⟶ 1,776:
11 circles are fully contained within other circles.
The approximate area is: 21.5353837542434 using
·
·
·
The approximate area is: 21.5536134808976 using
The approximate area is: 21.5615597720034 using
The approximate area is: 21.5638384878351 using
The approximate area is: 21.5646564883901 using
The approximate area is: 21.5649121135635 using
The approximate area is: 21.5650006694272 using
The approximate area is: 21.5650301119695 using
</pre>
|