cirrange(number[, max]) -> restricted_number
Force a number into a given range [0, max).
number
: the number to modify. Can be a scalar or an array.max
(optional numerical argument): specify the extremum of the range [0, max) into which the number should be restricted. If omitted, defaults to360.0
.
The converted number or array of numbers, as AbstractFloat
.
Restrict an array of numbers in the range [0, 2π) as if they are angles expressed in radians:
julia> cirrange([4pi, 10, -5.23], 2.0*pi)
3-element Array{Float64,1}:
0.0
3.71681
1.05319
This function does not support the radians
keyword like IDL implementation. Use max=2.0*pi
to restrict a number to the same interval.
Code of this function is based on IDL Astronomy User's Library.