Length of an arc between two angles: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add BASIC) |
|||
Line 381: | Line 381: | ||
{{out}} |
{{out}} |
||
<pre>arc length: 43.633231299858</pre> |
<pre>arc length: 43.633231299858</pre> |
||
=={{header|Nim}}== |
|||
<lang Nim>import math, strformat |
|||
func arcLength(r, a, b: float): float = |
|||
## Return the length of the major arc in a circle of radius "r" |
|||
## between angles "a" and "b" expressed in radians. |
|||
let d = abs(a - b) |
|||
result = r * (if d >= PI: d else: 2 * PI - d) |
|||
echo &"Arc length: {arcLength(10, degToRad(10.0), degToRad(120.0)):.5f}"</lang> |
|||
{{out}} |
|||
<pre>Arc length: 43.63323</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |