Number names/REXX: Difference between revisions

m
alligned some text.
(Moved the REXX program to its own page. -- ~~~~)
m (alligned some text.)
 
(7 intermediate revisions by 2 users not shown)
Line 1:
The full source of the   '''$SPELL#'''   REXX program is included here ──►   [[$SPELL.REX|$SPELL#.REX]].
<br>The full help for the&nbsp; &nbsp; &nbsp; '''$SPELL#''' &nbsp; REXX program is included here ──► &nbsp; [[$SPELL.HEL|$SPELL#.HEL]].
 
<br><br>As I understand the solving of any Rosetta Code task, it's OK to use a pre-existing computer language program.
<br>I had first considered taking the original program and ripping out all the good stuff and just solve the
 
<br>primary task (and optional requirements), but it was taking too much time so I left the program intact.
<br>I had first considered taking the original program and ripping out all the "good stuff" and just solve the primary task (and optional requirements), but it was taking too much time so I left the (whole) REXX program intact.
<br>Not included is the '''$H''' program which shows (among other things) the help (documentation).
 
<br>Not included here is the &nbsp; '''$H''' &nbsp; REXX program which shows (among other things) thevarious forms of help &nbsp; (program documentation, program/help author, sample uses, or logic flow). <br><br>
 
This REXX program supports:
 
* long &and short scale &nbsp; (American and British styles)
* ''ordinal numbers'' &nbsp; and &nbsp; ''cardinal numbers''
* expressing the number as a YEAR(calendar) &nbsp; ''year'' &nbsp; &nbsp; ('''1975''' would be '''nineteen seventy-five''')
* decimal points &nbsp; (<big>'''6'''</big> &nbsp; is different than &nbsp; <big>'''6.'''</big>)
* decimal fractions
* numbers with leading zeroes (as well as trailing zeroes)
* leading signs &nsbpnbsp; (<big>'''+'''</big> or <big>'''-'''</big>)
* exponential notation
* currency symbols
* adding commas (or whatever) to the output (including blanks)
* numbers &nbsp; (American) roughly up to 3,000 digits
* numbers &nbsp; (English) &nbsp; &nbsp; roughly up to 6,000 digits
* numbers with metric suffixes such as '''K''', '''M''', '''Gi''', etc, and also some common ones as well asnamely: factorials
** '''K M G T P E Z Y X W V U'''
* user-defineable names for: &nbsp; signs, decimal point, power, currency symbols, zero (digit), etc.
* numbers with binary suffixes, namely:
** '''Ki Mi Gi Ti Pi Ei Zi Yi Xi Wi Vi Ui'''
** the above suffixes can be combined: &nbsp; '''44MM''' &nbsp; (44 million million)
* numbers with some common suffixes such as:
** '''dozens'''
** '''gross'''
** '''greatgross'''
** '''pairs'''
** '''scores'''
** '''googols'''
** or any suitable abbreviation of the above
* numbers expressed as a factorial &nbsp; (such as &nbsp; '''100!''').
* user-definable names for:
** signs &nbsp; &nbsp; ('''-6''' &nbsp; ''could be'' &nbsp; expressed as &nbsp; '''negatory six''')
** decimal point &nbsp; &nbsp; ('''2.4''' &nbsp; ''could be'' &nbsp; expressed as &nbsp; '''two boink four''')
** power &nbsp; (the power of ten that the number is being raised to)
** currency symbols
** zero (the digit)
** blanks
** a value of zero
* numbers may have commas but they aren't enunciated
 
The program has a pretty hefty prologue which determines &nbsp; (among other things):
Line 27 ⟶ 50:
* the operating system (and maybe the type)
* the name of the REXX program: it's filename, filetype, filemode (or path, if you will)
* the access-name used to acquire environmental variables' values
* if '''EBCDIC''' or '''ASCII''' system
* which REXX (or KEXX) is being used
* the name of the program (command) used to clear the terminal screen
* if appropriate, invokes <code>&nbsp; '''$H</code>''' &nbsp; to show the help/, logic flow/, sample uses/or, programor author.
 
I'm still working on the REXX program to reduce the amount of names by programmatically generating any amount of number-names &nbsp; (instead of having a fixed amount of names in text form).
 
Also note that there appears not to be a consensus on the names of some numbers:
Line 42 ⟶ 65:
* '''tre*''' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; also named '''tres*'''
 
<br><br>The &nbsp; '''$SPELL#''' &nbsp; REXX program makes use of &nbsp; '''$T''' &nbsp; REXX program which is used to display text and/or write the text to a file.
<br>The &nbsp; '''$T''' &nbsp; REXX program is included here &nbsp; ──► &nbsp; [[$T.REX]].
<br>The help for the &nbsp; '''$T''' &nbsp; REXX program is included here ──► &nbsp; [[$T.HEL]].
<br><br>The &nbsp; '''$SPELL#''' &nbsp; REXX program makes use of &nbsp; '''$ERR''' &nbsp; REXX program which is used to display error messages (via '''$T''').
<br>The &nbsp; '''$ERR''' &nbsp; REXX program is included here &nbsp; ──► &nbsp; &nbsp; [[$ERR.REX]].
<br>The help for the &nbsp; '''$ERR''' &nbsp; REXX program is included here &nbsp; ──► &nbsp; [[$ERR.HEL]].
<br><br>Some older REXXes don't have a &nbsp; '''changestr''' bif&nbsp; BIF, so one is included here &nbsp; ──► &nbsp; [[CHANGESTR.REX]].
<br><br>
 
==output==
Output when using the input of: &nbsp; <tt> 373 ordinal </tt>
three hundred seventy-third
 
Output when using the input of: &nbsp; <tt> 373 </tt>
three hundred seventy-three
 
Output when using the input of: &nbsp; <tt> +45 </tt>
plus forty-five
 
Output when using the input of: &nbsp; <tt> 1989 asYear </tt>
nineteen eighty-nine
 
Output when using the input of: &nbsp; <tt> -12.79 </tt>
minus twelve point seven nine
 
Output when using the input of: &nbsp; <tt> $119.63 </tt>
one hundred nineteen dollars and sixty-three cents
 
Output when using the input of: &nbsp; <tt> 3456T </tt>
three quadrillion four hundred fifty-six trillion
 
Output when using the input of: &nbsp; <tt> 4Ki </tt>
four thousand ninety-six
 
Output when using the input of: &nbsp; <tt> 6! </tt>
seven hundred twenty
 
Output when using the input of: &nbsp; <tt> 10dozen </tt>
one hundred twenty
 
Output when using the input of: &nbsp; <tt> 70000000000000... </tt> &nbsp; &nbsp; (3,000 zeroes total)
seven octononagintanongentillion