Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
sigdgt

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

     SIGDGT ( Retain significant digits )

     SUBROUTINE SIGDGT ( IN, OUT )

Abstract

     Retain only the significant digits in a numeric string.

Required_Reading

     None.

Keywords

     CHARACTER
     PARSING

Declarations

     IMPLICIT NONE

     CHARACTER*(*)    IN
     CHARACTER*(*)    OUT

Brief_I/O

     VARIABLE  I/O  DESCRIPTION
     --------  ---  --------------------------------------------------
     IN         I   Input numeric string.
     OUT        O   Numeric string, with insignificant digits removed.

Detailed_Input

     IN       is a numeric string.

Detailed_Output

     OUT      is the same numeric string with insignificant
              zeros and spaces removed. The special case '.000...'
              becomes just '0'. OUT may overwrite IN. If the
              output string is too long, it is truncated on the
              right.

Parameters

     None.

Exceptions

     Error free.

     1)  If IN is a non-numeric string, the contents of OUT are
         unpredictable.

Files

     None.

Particulars

     There are only two interesting cases:

        1) There is a decimal point and an exponent immediately
           preceded by zero ('...0E', '...0D', '...0e', '...0d')
           or by a space ('... E', '... D', '... e', '... d').

        2) There is a decimal point and no exponent, and the last non-
           blank character is a zero ('...0').

     In each of these cases, go to the zero in question, and step
     backwards until you find something other than a blank or a zero.

     Finally, remove all leading spaces, and all occurrences of more
     than one consecutive space within the string.

Examples

     The following examples illustrate the use of SIGDGT.

     '0.123456000000D-04'        becomes     '0.123456D-04'
     '  -9.2100000000000'                    '-9.21'
     '       13'                             '13'
     '    00013'                             '00013'
     ' .314 159 265 300 000 e1'              '.314 159 265 3e1'
     '   123    45     6'                    '123 45 6'
     '  .000000000'                          '0'

Restrictions

     None.

Literature_References

     None.

Author_and_Institution

     N.J. Bachman       (JPL)
     J. Diaz del Rio    (ODC Space)
     H.A. Neilan        (JPL)
     W.L. Taber         (JPL)
     I.M. Underwood     (JPL)

Version

    SPICELIB Version 1.1.0, 12-AUG-2021 (JDR)

        Added IMPLICIT NONE statement.

        Edited the header to comply with NAIF standard.

    SPICELIB Version 1.0.1, 10-MAR-1992 (WLT)

        Comment section for permuted index source lines was added
        following the header.

    SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) (HAN) (NJB) (WLT)
Fri Dec 31 18:36:48 2021