next up previous
Next: CHR_DTOC - Encode a DOUBLE PRECISION value as a string
Up: Routine Descriptions
Previous: CHR_DELIM - Locate a substring using a given delimiter character

CHR_DTOAN  -  Write a DOUBLE PRECISION value into a string as hr/deg:min:sec

Description:
Format a DOUBLE PRECISION value as hours/degrees:minutes:seconds and write it into a character string. This routine is for writing angular measures into a character string in a format suitable for presentation to an astronomer.

If the absolute value of the number to be written exceeds a predefined maximum a conversion is not attempted, but the number is written as a real number in Fortran `exponential' format and a couple of question marks are appended to its end. This prevents silly results when very large numbers are input. The variable UNITS controls the maximum permitted value for the conversion to be carried out.

The value is written into the part of the string beginning at position IPOSN+1 and IPOSN is returned updated to the position of the end of the encoded angle in STRING.

Invocation:
CALL CHR_DTOAN( DVALUE, UNITS, STRING, IPOSN )

Arguments:
DVALUE = DOUBLE PRECISION (Given)
The value to be encoded into the string. This value should represent an angular measure.
UNITS = CHARACTER ( ) (Given)
This string controls the maximum value which will be formatted as hr/deg:min:sec: if UNITS = 'HOURS', the maximum permitted value is 24.0; if UNITS = 'DEGREES', the maximum permitted is 360.0. In all other cases the maximum is 1000.0.
STRING = CHARACTER ( ) (Given and Returned)
The string into which DVALUE is written.
IPOSN = INTEGER (Given and Returned)
Given as the last element in STRING before the beginning of the encoded angle. Returned as the element in STRING corresponding to the end of the encoded angle.



next up previous
Next: CHR_DTOC - Encode a DOUBLE PRECISION value as a string
Up: Routine Descriptions
Previous: CHR_DELIM - Locate a substring using a given delimiter character



CHR Character Handling Routines
Starlink User Note 40
A C Charles
P C T Rees
A J Chipperfield
2 August 1995
E-mail:ussc@star.rl.ac.uk