toggle_degrees_mode Subroutine

subroutine toggle_degrees_mode(new_mode)

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: new_mode

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: i
type(rpn_t), public :: rz

Source Code

    subroutine toggle_degrees_mode(new_mode)
        logical, intent(in) :: new_mode
        integer    :: i
        type(rpn_t) :: rz
        
        ! Only do something if the modes are different
        if (new_mode .eqv. degrees_mode) return
        
        degrees_mode = .not. degrees_mode
        
        ! Convert all polar complex numbers
        ! 1) In the stack
        do i=1,stack%ssize
            rz = stack%peek(i)
            call update_angle_unit(rz)
            call stack%set(rz,i)
        end do
        
        ! 2) in memory
        do i=lbound(mem,1),ubound(mem,1)
            call update_angle_unit(mem(i))
        end do
        
        ! 3) in multiple roots
        do i=1,nroots
            call update_angle_unit(roots(i))
        end do
          
    end subroutine toggle_degrees_mode