package body Universe is

  function Degree_To_Radian (D: Degree) return Radian is
  begin
    return Radian (D * PI / 180.0);
  end Degree_To_Radian;

  -- Remaining conversions

  function Sin (X: Degree) return SI_Unit is
  begin
    return SI_Unit (Degree'(Sin (X)));  -- 3
  end Sin;

  -- Remaining trigonometric functions and their inverses

end Universe;


Remark on the code:

3 For the implementation of the trigonometric functions, because of overloading a qualified expression type_mark'(expression) is needed. Degree'(Sin (X)) denotes that sine which affords the argument type of X and produces the result type Degree. Since the function body consists only of a type conversion, use of pragma Inline (in the package specification) is appropriate. This pragma should be specified for all conversion functions like Kilometer_To_Meter as well.


Back to text.