Task

If your language has a library or built-in functions for trigonometry, show examples of:

   sine
   cosine
   tangent
   inverses   (of the above)

using the same angle in radians and degrees.

For the non-inverse functions,   each radian/degree pair should use arguments that evaluate to the same angle   (that is, it's not necessary to use the same angle for all three regular functions as long as the two sine calls use the same angle).

For the inverse functions,   use the same number and convert its answer to radians and degrees.

If your language does not have trigonometric functions available or only has some available,   write functions to calculate the functions based on any   known approximation or identity.




       IDENTIFICATION DIVISION.
       PROGRAM-ID. Trig.
 
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Pi-Third   USAGE COMP-2.
       01  Degree     USAGE COMP-2.
 
       01  60-Degrees USAGE COMP-2.
 
       01  Result     USAGE COMP-2.
 
       PROCEDURE DIVISION.
           COMPUTE Pi-Third = FUNCTION PI / 3
 
           DISPLAY "Radians:"
           DISPLAY "  Sin(π / 3)  = " FUNCTION SIN(Pi-Third)
           DISPLAY "  Cos(π / 3)  = " FUNCTION COS(Pi-Third)
           DISPLAY "  Tan(π / 3)  = " FUNCTION TAN(Pi-Third)
           DISPLAY "  Asin(0.5)   = " FUNCTION ASIN(0.5)
           DISPLAY "  Acos(0.5)   = " FUNCTION ACOS(0.5)
           DISPLAY "  Atan(0.5)   = " FUNCTION ATAN(0.5)
 
           COMPUTE Degree = FUNCTION PI / 180
           COMPUTE 60-Degrees = Degree * 60
 
           DISPLAY "Degrees:"
           DISPLAY "  Sin(60°)  = " FUNCTION SIN(60-Degrees)
           DISPLAY "  Cos(60°)  = " FUNCTION COS(60-Degrees)
           DISPLAY "  Tan(60°)  = " FUNCTION TAN(60-Degrees)
           COMPUTE Result = FUNCTION ASIN(0.5) / 60
           DISPLAY "  Asin(0.5) = " Result
           COMPUTE Result = FUNCTION ACOS(0.5) / 60
           DISPLAY "  Acos(0.5) = " Result
           COMPUTE Result = FUNCTION ATAN(0.5) / 60
           DISPLAY "  Atan(0.5) = " Result
 
           GOBACK
           .