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
inttxt

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

     INTTXT ( Convert an integer to text )

     SUBROUTINE INTTXT ( N, STRING )

Abstract

     Convert an integer to an equivalent written phrase.
     For example, convert 121 to 'ONE HUNDRED TWENTY-ONE'.

Required_Reading

     None.

Keywords

     CONVERSION
     PARSING
     STRING
     UNITS
     UTILITY

Declarations

     IMPLICIT NONE

     INTEGER               N
     CHARACTER*(*)         STRING

Brief_I/O

     VARIABLE  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_Input

     N        is any integer (less than 10**12 in absolute value).
              If N is less than 0, -N must be a legitimate number.

Detailed_Output

     STRING   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'

Parameters

     None.

Exceptions

     Error 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.

Files

     None.

Particulars

     This 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'

Examples

     N           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

Restrictions

     1)  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_References

     None.

Author_and_Institution

     J. Diaz del Rio    (ODC Space)
     W.L. Taber         (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, 15-AUG-1990 (WLT)
Fri Dec 31 18:36:28 2021