Wrap an angle (in rad) from -pi to pi.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | a |
pure elemental function wrap_angle(a) result(r) implicit none real(wp),intent(in) :: a real(wp) :: r r = mod(a,twopi) if (abs(r)>pi) r = r - sign(twopi,r) end function wrap_angle