Good to know.  The proposed method does not appear to have issues dealing 
with this.  Multi-dispatch can still pick up the appropriate trig() 
function.  See snippet I just added for angles:
https://github.com/ma-laforge/testcases/blob/master/units_test/units_test_angles.jl

As the code shows: Functions are easy to add once types are defined:
Base.sin(x::Radians) = sin(val(x))
Base.sin(x::Degrees) = sind(val(x))
Base.sin(x::Angle) = sin(Radians(x))

Typed angles should help maintain a compact namespace (even if we include 
"Revolutions" as an angle).

As for Stuart's comment:
Maybe Julia modules should include a Matlab compatibility submodules to 
reduce clutter:
module Trigonometry #Probably excessive
...
   module MatlabCompatibility
   ...
   end
end

module Algebra #Probably excessive
...
   module MatlabCompatibility
   ...
   end
end

using Trigonometry
using Algebra
using MatlabCompatibility

On Sunday, March 1, 2015 at 5:00:24 PM UTC-5, Steven G. Johnson wrote:
>
> The errors in sin and cos can be much larger than 1ulp for sin or cos of 
> large phase angles (>> 360) in degrees, because pi is not exactly 
> representable in fp while 180 is. 

Reply via email to