The coordinate values associated with each axis of a Frame are stored (e.g. within your program) as double precision values. The Frame class therefore provides a function, AST_FORMAT, to convert these values into formatted strings for display:
CHARACTER * ( 50 ) STRING
DOUBLE PRECISION VALUE
...
STRING = AST_FORMAT( FRAME, IAXIS, VALUE, STATUS )
Here, the AST_FORMAT character function is passed a Frame pointer, the number of an axis (IAXIS) and a double precision value to format (VALUE). It returns a character string containing the formatted value. By default, the formatting applied will be determined by the Frame's Digits attribute and will normally display results with seven digits of precision (corresponding approximately to the Fortran REAL data type on many machines). Setting a different Digits value, however, allows you to adjust the precision as necessary to suit the accuracy of the coordinate data you are processing. If finer control is needed, it is also possible to set a Digits value for each individual axis by appending an axis number to the attribute name (e.g. ``Digits(2)''). If this is done, it over-rides the effect of the Frame's main Digits value for that axis.
Even finer control is possible by setting the (character string)
Format attribute for a Frame axis. The string given should contain a
format specifier which explicitly determines how the values on
that axis should be formatted. This will over-ride the effects of any
Digits value. Unfortunately for Fortran programmers, this must be a C
language format specifier, so you might find the Digits
approach preferable.
The simplest type of format specifier takes the form ``%m.nG'', where ``m'' and ``n'' are integers giving the minimum field width in characters and the number of significant digits to display (e.g. ``%10.5G''). Other formatting options are also possible and if you need to use them you may wish to consult a book on C (see the ``printf'' function), remembering that you want to format a double precision (C double) value.
It is recommended that you use AST_FORMAT whenever you display formatted coordinate values, even although you could format them yourself using a WRITE statement. This is because it puts the Frame in control of formatting. When you start to handle more elaborate Frames (representing, say, celestial coordinates), you will need different formatting methods. This approach delivers them without any change to your software.
You should also consider regularly using the AST_NORM routine,
described below (), for any values that will be
made visible to the user of your software.
AST A Library for Handling World Coordinate Systems in Astronomy