split Subroutine

private subroutine split(tt, fr)

this subroutine breaks a d.p. number into a d.p. integer and a d.p. fractional part.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tt

d.p. input number

real(kind=wp), intent(out), dimension(2) :: fr

d.p. 2-word output array. fr(1) contains integer part fr(2) contains fractional part for negative input numbers, fr(1) contains the next more negative integer; fr(2) contains a positive fraction.


Called by

proc~~split~~CalledByGraph proc~split jpl_ephemeris_module::split proc~state jpl_ephemeris_module::jpl_ephemeris%state proc~state->proc~split proc~get_state jpl_ephemeris_module::jpl_ephemeris%get_state proc~get_state->proc~state proc~ephemeris_test jpl_ephemeris_module::ephemeris_test proc~ephemeris_test->proc~get_state proc~get_rv_from_jpl_ephemeris jpl_ephemeris_module::jpl_ephemeris%get_rv_from_jpl_ephemeris proc~get_rv_from_jpl_ephemeris->proc~get_state

Source Code

    subroutine split(tt,fr)

    implicit none

    real(wp),intent(in)               :: tt  !! d.p. input number
    real(wp),dimension(2),intent(out) :: fr  !! d.p. 2-word output array.
                                             !! fr(1) contains integer part
                                             !! fr(2) contains fractional part
                                             !! for negative input numbers, fr(1) contains the next
                                             !! more negative integer; fr(2) contains a positive fraction.

    ! get integer and fractional parts

    fr(1) = int(tt)
    fr(2) = tt-fr(1)

    if (tt>=0.0_wp .or. fr(2)==0.0_wp) return

    ! make adjustments for negative input number

    fr(1) = fr(1) - 1.0_wp
    fr(2) = fr(2) + 1.0_wp

    end subroutine split