inttxt |
Table of contents
ProcedureINTTXT ( Convert an integer to text ) SUBROUTINE INTTXT ( N, STRING ) AbstractConvert an integer to an equivalent written phrase. For example, convert 121 to 'ONE HUNDRED TWENTY-ONE'. Required_ReadingNone. KeywordsCONVERSION PARSING STRING UNITS UTILITY DeclarationsIMPLICIT NONE INTEGER N CHARACTER*(*) STRING Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- N I An integer (less than 10**12 in absolute value). STRING O An English string representing the cardinal of N. Detailed_InputN is any integer (less than 10**12 in absolute value). If N is less than 0, -N must be a legitimate number. Detailed_OutputSTRING is the English cardinal equivalent of N. STRING will contain only upper case letters. The longest possible output string contains 145 characters. One such string is: 'NEGATIVE ' // 'SEVEN HUNDRED SEVENTY-SEVEN BILLION ' // 'SEVEN HUNDRED SEVENTY-SEVEN MILLION ' // 'SEVEN HUNDRED SEVENTY-SEVEN THOUSAND ' // 'SEVEN HUNDRED SEVENTY-SEVEN' ParametersNone. ExceptionsError free. 1) If the resulting text is longer than the output string, it will be truncated on the right, leaving only the most significant portion of the number. FilesNone. ParticularsThis routine is used primarily for constructing error messages. For example, an overflow message might look like the following: 'An excess of seventy-four parameters was detected.' A second use might be to write dollar amounts: it's much harder to tamper with a string like 'Two thousand four hundred seventy-one dollars' than with the equivalent string '$ 2471.00' ExamplesN STRING ------ ------------------------------------------ -43 NEGATIVE FORTY-THREE 1 ONE 2 TWO 3 THREE 4 FOUR 20 TWENTY 21 TWENTY-ONE 99 NINETY-NINE 82131 EIGHTY-TWO THOUSAND ONE HUNDRED THIRTY-ONE Restrictions1) This routine assumes that N will always be less than a trillion (10**12) in absolute value. 2) In the event that N is less than zero, this routine assumes that -N is a legitimate integer on the host machine. 3) This routine assumes that an integer as large as 10**9 (one billion) is representable on the host machine. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) W.L. Taber (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, 15-AUG-1990 (WLT) |
Fri Dec 31 18:36:28 2021