Angle difference between two bearings: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: used more centering for a better display, used a template for the output section.)
(→‎{{header|J}}: J uses the mathematical mod, so fancy positivity manipulations are unnecessary.)
Line 553: Line 553:
=={{header|J}}==
=={{header|J}}==


<lang j>relativeBearing=: -&360^:(180&<)@(360 | 720 + -~)/</lang>
<lang j>relativeBearing=: (180 -~ 360 | 180 + -~)/"1</lang>
<lang j>tests=: _99&".;._2 noun define
<lang j>tests=: _99&".;._2 noun define
20 45
20 45
Line 568: Line 568:
60175.77306795546 42213.07192354373
60175.77306795546 42213.07192354373
)
)
tests ,. relativeBearing"1 tests
tests ,. relativeBearing tests
20 45 25
20 45 25
_45 45 90
_45 45 90