! 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.

! Example 6.25. Complex numbers in Fortran style and in polar form.
  program G25
    use G25M
    implicit none
    complex, parameter :: Z1 = (0.707107, 0.707107)
    complex :: Z2, Z3
    type (Polar) :: P1, P2, P3
! start program G25
    read (unit = *, fmt = *) Z2
    write (unit = *, fmt = *) " Complex numbers: ", Z1, Z2
    P1 = Complex_To_Polar( Z1 )
    P2 = Complex_To_Polar( Z2 )
    write (unit = *, fmt = *) " Same numbers in polar form: "
    call Print_Polar( P1 )
    call Print_Polar( P2 )
    P3 = Mult_Polar( P1, P2)
    write (unit = *, fmt = *) " Product in polar form: "
    call Print_Polar( P3 )
    Z3 = Polar_To_Complex( P3 )
    write (unit = *, fmt = *) " Complex product: ", Z3
    stop
  end program G25
