Decompose radians into hours, minutes, seconds, fraction.
Status: vector/matrix support routine.
NDP resolution
: ...0000 00 00
-7 1000 00 00
-6 100 00 00
-5 10 00 00
-4 1 00 00
-3 0 10 00
-2 0 01 00
-1 0 00 10
0 0 00 01
1 0 00 00.1
2 0 00 00.01
3 0 00 00.001
: 0 00 00.000...
The largest useful value for NDP is determined by the size of ANGLE, the format of REAL(WP) floating-point numbers on the target platform, and the risk of overflowing IHMSF(4). On a typical platform, for ANGLE up to 2pi, the available floating-point precision might correspond to NDP=12. However, the practical limit is typically NDP=9, set by the capacity of a 32-bit IHMSF(4).
The absolute value of ANGLE may exceed 2pi. In cases where it does not, it is up to the caller to test for and handle the case where ANGLE is very nearly 2pi and rounds up to 24 hours, by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ndp | resolution (Note 1) |
||
real(kind=wp), | intent(in) | :: | angle | angle in radians |
||
character(len=*), | intent(out) | :: | sign | '+' or '-' |
||
integer, | intent(out), | dimension(4) | :: | ihmsf | hours, minutes, seconds, fraction |
subroutine A2TF ( ndp, angle, sign, ihmsf )
implicit none
integer,intent(in) :: ndp !! resolution (Note 1)
real(wp),intent(in):: angle !! angle in radians
character(len=*),intent(out) :: sign !! '+' or '-'
integer,dimension(4),intent(out) :: ihmsf !! hours, minutes, seconds, fraction
! Scale then use days to h,m,s routine.
call D2TF ( ndp, angle/d2pi, sign, ihmsf )
end subroutine A2TF