ANN: UnitfulAngles.jl

UnitfulAngles.jl is a supplemental units package for Unitful.jl.

Since it’s registered, you can install it by Pkg.add("UnitfulAngles").

UnitfulAngles.jl introduces all the angular units found in Wikipedia’s articles Angle § Units, Angular unit and Circular sector.

  • All the trigonometric functions work as expected:
julia> using UnitfulAngles

julia> import UnitfulAngles: °, rad, octant

julia> sin(30°)
0.5

julia> cos(π*rad)
-1.0

julia> tan(1octant)
1.0
  • In order to get inverse functions to return a specific unit, specify the desired unit as the first argument:
julia> import UnitfulAngles.turn

julia> asin(turn, 1)
0.25 τ
  • As a bonus, you can also convert between an angle and Time:
julia> convert(Dates.Time, 200u"grad")
12:00:00

julia> convert(u"sextant", Dates.Time(4,0,0))
1.0 sextant

PR etc are all very welcome!

11 Likes