Angle difference between two bearings: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: Replaced (if then else) with guards)
Line 713: Line 713:
(ax, ay) = (sin a, cos a)
(ax, ay) = (sin a, cos a)
(bx, by) = (sin b, cos b)
(bx, by) = (sin b, cos b)
sign -- cross-product > 0 ?
sign
| ((ay * bx) - (by * ax)) > 0 = 1
=
if ((ay * bx) - (by * ax)) > 0
| otherwise = -1
then 1
else (-1)


degrees :: Radians -> Degrees
degrees :: Radians -> Degrees