idlastro / Miscellaneous (Non-Astronomy) Procedures: F_FORMAT

[Source code]

NAME
F_FORMAT
PURPOSE
Choose a nice floating format for displaying an array of REAL data.
EXPLANATION
Called by TVLIST, IMLIST.
CALLING SEQUENCE
fmt = F_FORMAT( minval, maxval, factor, [ length ] )
INPUTS
MINVAL - REAL scalar giving the minimum value of an array of numbers
        for which one desires a nice format.
MAXVAL - REAL scalar giving maximum value in array of numbers
OPTIONAL INPUT
LENGTH - length of the output F format (default = 5)
        must be an integer scalar > 2
OUTPUT
FMT - an F or I format string, e.g. 'F5.1'
FACTOR - factor of 10 by which to multiply array of numbers to achieve
        a pretty display using format FMT.
EXAMPLE
Find a nice format to print an array of numbers with a minimum of 5.2e-3
and a maximum  of 4.2e-2.
        IDL> fmt = F_FORMAT( 5.2e-3, 4.2e-2, factor )
yields fmt = '(F5.2)' and factor = .01, i.e. the array can be displayed
with a F5.2 format after multiplication by 100.
REVISION HISTORY
Written W. Landsman              December 1988
Deal with factors < 1.           August 1991
Deal with factors < 1. *and* a large range    October 1992
Now returns In format rather than Fn.0    February, 1994
Converted to IDL V5.0   W. Landsman   September 1997
ix display problem for large negative numbers   W. Landsman   Mar 2016