! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

  module H02M
    implicit none
    public :: Complex_To_Polar
    type, public :: Polar
      real :: R, Theta
    end type Polar
  contains
    function Complex_To_Polar( Z ) result( CTP_R )
      complex, intent (in) :: Z
      type (Polar) :: CTP_R
      CTP_R % R = abs( Z )
      CTP_R % Theta = atan2( aimag( Z ), real( Z ) )
      return
    end function Complex_To_Polar
  end module H02M
