sigdgt |
Table of contents
ProcedureSIGDGT ( Retain significant digits ) SUBROUTINE SIGDGT ( IN, OUT ) AbstractRetain only the significant digits in a numeric string. Required_ReadingNone. KeywordsCHARACTER PARSING DeclarationsIMPLICIT NONE CHARACTER*(*) IN CHARACTER*(*) OUT Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- IN I Input numeric string. OUT O Numeric string, with insignificant digits removed. Detailed_InputIN is a numeric string. Detailed_OutputOUT 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. ParametersNone. ExceptionsError free. 1) If IN is a non-numeric string, the contents of OUT are unpredictable. FilesNone. ParticularsThere 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. ExamplesThe 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' RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB 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