      program tangent

          implicit none

          real :: V1, V2, V3, TV1, TV2, PI, A, B, R

          ! case 1
          V1 = -7.10521984100341796875000000000000000
          V2 = -0.40112295746803283691406250000000000
          V3 = 2.0
          PI = 3.141592

          TV1 = -TAND(V1)
          TV2 = TAN(V2)

          A = ACOS(TV1*TV2)
          B = 1.0+0.033*COS(2*PI*V3/365.0)

          R = 15.392*B*(A*SIND(V1)*SIN(V2)+COSD(V1)*COS(V2)*SIN(A))

          write(*,'(A)') 'Case 1:'
          write(*,'(A,F40.35)')  'V1:  ', V1
          write(*,'(A,F40.35)')  'V2:  ', V2
          write(*,'(A,F40.35)')  'TV1: ', TV1
          write(*,'(A,F40.35)')  'TV2: ', TV2
          write(*,'(A,F40.35)')  'A:   ', A
          write(*,'(A,F40.35)')  'B:   ', B
          write(*,'(A,F40.35)')  'R:   ', R

          ! case 2
          V1 = -10.81274986267089843750000000000000000
          V2 = -0.40112295746803283691406250000000000
          V3 = 2.0
          PI = 3.141592

          TV1 = -TAND(V1)
          TV2 = TAN(V2)

          A = ACOS(TV1*TV2)
          B = 1.0+0.033*COS(2*PI*V3/365.0)

          R = 15.392*B*(A*SIND(V1)*SIN(V2)+COSD(V1)*COS(V2)*SIN(A))

          write(*,'(A)') 'Case 2:'
          write(*,'(A,F40.35)')  'V1:  ', V1
          write(*,'(A,F40.35)')  'V2:  ', V2
          write(*,'(A,F40.35)')  'TV1: ', TV1
          write(*,'(A,F40.35)')  'TV2: ', TV2
          write(*,'(A,F40.35)')  'A:   ', A
          write(*,'(A,F40.35)')  'B:   ', B
          write(*,'(A,F40.35)')  'R:   ', R

      end program tangent
