This task is about expressing numbers with an attached (abutted) suffix multiplier(s),   the suffix(es) could be:

   an alphabetic (named) multiplier which could be abbreviated
    metric  multiplier(s) which can be specified multiple times
   "binary" multiplier(s) which can be specified multiple times
   explanation marks (!) which indicate a factorial or multifactorial


The (decimal) numbers can be expressed generally as:

             {±}   {digits}   {.}   {digits}
                                 ────── or ──────
             {±}   {digits}   {.}   {digits}   {E or e}   {±}   {digits}

where:

   numbers won't have embedded blanks   (contrary to the expaciated examples above where whitespace was used for readability)
   this task will only be dealing with decimal numbers,   both in the   mantissa   and   exponent
   ±   indicates an optional plus or minus sign   (+   or   -)
   digits are the decimal digits   (0 ──► 9)
   the digits can have comma(s) interjected to separate the   periods   (thousands)   such as:   12,467,000
   .   is the decimal point, sometimes also called a   dot
   e   or   E   denotes the use of decimal exponentiation   (a number multiplied by raising ten to some power)


This isn't a pure or perfect definition of the way we express decimal numbers,   but it should convey the intent for this task.

The use of the word   periods   (thousands) is not meant to confuse, that word (as used above) is what the comma separates;

the groups of decimal digits are called periods,   and in almost all cases, are groups of three decimal digits.

If an   e   or   E   is specified, there must be a legal number expressed before it,   and there must be a legal (exponent) expressed after it.

Also, there must be some digits expressed in all cases,   not just a sign and/or decimal point.

Superfluous signs, decimal points, exponent numbers, and zeros   need not be preserved.

I.E.:      
+7   007   7.00   7E-0   7E000   70e-1     could all be expressed as 7

All numbers to be "expanded" can be assumed to be valid and there won't be a requirement to verify their validity.



Abbreviated alphabetic suffixes to be supported   (where the capital letters signify the minimum abbreation that can be used)

     PAIRs         multiply the number by  2         (as in pairs of shoes or pants)
     SCOres        multiply the number by  20        (as 3score would be 60)
     DOZens        multiply the number by  12
     GRoss         multiply the number by  144       (twelve dozen)
     GREATGRoss    multiply the number by  1,728     (a dozen gross)
     GOOGOLs       multiply the number by  10^100    (ten raised to the 100&sup>th</sup> power)



Note that the plurals are supported, even though they're usually used when expressing exact numbers   (She has 2 dozen eggs, and dozens of quavas)



Metric suffixes to be supported   (whether or not they're officially sanctioned)

     K     multiply the number by  10^3              kilo      (1,000)
     M     multiply the number by  10^6              mega      (1,000,000)
     G     multiply the number by  10^9              giga      (1,000,000,000)
     T     multiply the number by  10^12             tera      (1,000,000,000,000)
     P     multiply the number by  10^15             peta      (1,000,000,000,000,000)
     E     multiply the number by  10^18             exa       (1,000,000,000,000,000,000)
     Z     multiply the number by  10^21             zetta     (1,000,000,000,000,000,000,000)
     Y     multiply the number by  10^24             yotta     (1,000,000,000,000,000,000,000,000)
     X     multiply the number by  10^27             xenta     (1,000,000,000,000,000,000,000,000,000)
     W     multiply the number by  10^30             wekta     (1,000,000,000,000,000,000,000,000,000,000)
     V     multiply the number by  10^33             vendeka   (1,000,000,000,000,000,000,000,000,000,000,000)
     U     multiply the number by  10^36             udekta    (1,000,000,000,000,000,000,000,000,000,000,000,000)



Binary suffixes to be supported   (whether or not they're officially sanctioned)

     Ki    multiply the number by  2^10              kibi      (1,024)
     Mi    multiply the number by  2^20              mebi      (1,048,576)
     Gi    multiply the number by  2^30              gibi      (1,073,741,824)
     Ti    multiply the number by  2^40              tebi      (1,099,571,627,776)
     Pi    multiply the number by  2^50              pebi      (1,125,899,906,884,629)
     Ei    multiply the number by  2^60              exbi      (1,152,921,504,606,846,976)
     Zi    multiply the number by  2^70              zeb1      (1,180,591,620,717,411,303,424)
     Yi    multiply the number by  2^80              yobi      (1,208,925,819,614,629,174,706,176)
     Xi    multiply the number by  2^90              xebi      (1,237,940,039,285,380,274,899,124,224)
     Wi    multiply the number by  2^100             webi      (1,267,650,600,228,229,401,496,703,205,376)
     Vi    multiply the number by  2^110             vebi      (1,298,074,214,633,706,907,132,624,082,305,024)
     Ui    multiply the number by  2^120             uebi      (1,329,227,995,784,915,872,903,807,060,280,344,576)



All of the metric and binary suffixes can be expressed in   lowercase,   uppercase,   or   mixed case.

All of the metric and binary suffixes can be   stacked   (expressed multiple times),   and also be intermixed:

I.E.:       123k   123K   123GKi   12.3GiGG   12.3e-7T   .78E100e



Factorial suffixes to be supported

     !      compute the (regular) factorial product:   5!   is  5 × 4 × 3 × 2 × 1  =  120
     !!     compute the  double   factorial product:   8!   is  8 × 6 × 4 × 2      =  384
     !!!    compute the  triple   factorial product:   8!   is  8 × 5 × 2          =   80
     !!!!   compute the quadruple factorial product:   8!   is  8 × 4              =   32
     !!!!!  compute the quintuple factorial product:   8!   is  8 × 3              =   24
     ··· the number of factorial symbols that can be specified is to be unlimited   (as per what can be entered/typed) ···



Factorial suffixes aren't, of course, the usual type of multipliers, but are used here in a similar vein.



Multifactorials aren't to be confused with   super─factorials     where   (4!)!   would be   (24)!.



Task

   Using the test cases (below),   show the "expanded" numbers here, on this page.
   For each list, show the input on one line,   and also show the output on one line.
   When showing the input line, keep the spaces (whitespace) and case (capitalizations) as is.
   For each result (list) displayed on one line, separate each number with two blanks.
   Add commas to the output numbers were appropriate.


Test cases

    2greatGRo   24Gros  288Doz  1,728pairs  172.8SCOre
    1,567      +1.567k    0.1567e-2m
    25.123kK    25.123m   2.5123e-00002G
    25.123kiKI  25.123Mi  2.5123e-00002Gi  +.25123E-7Ei
    -.25123e-34Vikki      2e-77gooGols
    9!   9!!   9!!!   9!!!!   9!!!!!   9!!!!!!   9!!!!!!!   9!!!!!!!!   9!!!!!!!!!

where the last number for the factorials has nine factorial symbols   (!)   after the   9



Related tasks

   Multifactorial                 (which has a clearer and more succinct definition of multifactorials.)
   Factorial



Other tasks related to string operations:

Metrics
 Array length
 String length
 Copy a string
 Empty string  (assignment)
Counting
 Word frequency
 Letter frequency
 Jewels and stones
 I before E except after C
 Bioinformatics/base count
 Count occurrences of a substring
 Count how many vowels and consonants occur in a string
Remove/replace
 XXXX redacted
 Conjugate a Latin verb
 Remove vowels from a string
 String interpolation (included)
 Strip block comments
 Strip comments from a string
 Strip a set of characters from a string
 Strip whitespace from a string -- top and tail
 Strip control codes and extended characters from a string
Anagrams/Derangements/shuffling
 Word wheel
 ABC problem
 Sattolo cycle
 Knuth shuffle
 Ordered words
 Superpermutation minimisation
 Textonyms (using a phone text pad)
 Anagrams
 Anagrams/Deranged anagrams
 Permutations/Derangements
Find/Search/Determine
 ABC words
 Odd words
 Word ladder
 Semordnilap
 Word search
 Wordiff  (game)
 String matching
 Tea cup rim text
 Alternade words
 Changeable words
 State name puzzle
 String comparison
 Unique characters
 Unique characters in each string
 Extract file extension
 Levenshtein distance
 Palindrome detection
 Common list elements
 Longest common suffix
 Longest common prefix
 Compare a list of strings 
 Longest common substring
 Find common directory path
 Words from neighbour ones
 Change e letters to i in words
 Non-continuous subsequences
 Longest common subsequence
 Longest palindromic substrings
 Longest increasing subsequence
 Words containing "the" substring
 Sum of the digits of n is substring of n
 Determine if a string is numeric
 Determine if a string is collapsible
 Determine if a string is squeezable
 Determine if a string has all unique characters
 Determine if a string has all the same characters
 Longest substrings without repeating characters
 Find words which contains all the vowels
 Find words which contains most consonants
 Find words which contains more than 3 vowels
 Find words which first and last three letters are equals
 Find words which odd letters are consonants and even letters are vowels or vice_versa
Formatting
 Substring
 Rep-string
 Word wrap
 String case
 Align columns
 Literals/String
 Repeat a string
 Brace expansion
 Brace expansion using ranges
 Reverse a string
 Phrase reversals
 Comma quibbling
 Special characters
 String concatenation
 Substring/Top and tail
 Commatizing numbers
 Reverse words in a string
 Suffixation of decimal numbers
 Long literals, with continuations 
 Numerical and alphabetical suffixes
 Abbreviations, easy
 Abbreviations, simple
 Abbreviations, automatic
Song lyrics/poems/Mad Libs/phrases
 Mad Libs
 Magic 8-ball
 99 Bottles of Beer
 The Name Game (a song)
 The Old lady swallowed a fly
 The Twelve Days of Christmas
Tokenize
 Text between
 Tokenize a string
 Word break problem
 Tokenize a string with escaping
 Split a character string based on change of character
Sequences
 Show ASCII table
 De Bruijn sequences
 Self-referential sequences
 Generate lower case ASCII alphabet




with javascript_semantics 
include builtins/bigatom.e
{} = ba_scale(34)   -- (min rqd for accuracy on the "Vikki" test)
                    -- (the default is 25, not quite enough here)

constant suffixes = {{"GREATGRoss",7,1728},
                     {"GOOGOLs",6,ba_new("1e100")},
                     {"SCOres",3,20},
                     {"DOZens",3,12},
                     {"GRoss",2,144},
                     {"PAIRs",4,2},
                     "KMGTPEZYXWVU"}

function decode(string suffix)
    bigatom res = BA_ONE
    suffix = upper(suffix)
    while length(suffix)>0 do
        bool found = false
        for i=length(suffix) to 2 by -1 do
            for s=1 to length(suffixes)-1 do
                if i<=length(suffixes[s][1])
                and i>=suffixes[s][2]
                and suffix[1..i]=upper(suffixes[s][1][1..i]) then
                    res = ba_mul(res,suffixes[s][3])
                    suffix = suffix[i+1..$]
                    found = true
                    exit
                end if
            end for
            if found then exit end if
        end for
        if not found then
            integer k = find(suffix[1],suffixes[$])
            if k=0 then ?9/0 end if
            if length(suffix)>=2 and suffix[2]='I' then
                res = ba_mul(res,ba_power(1024,k))
                suffix = suffix[3..$]
            else
                res = ba_mul(res,ba_power(1000,k))
                suffix = suffix[2..$]
            end if  
        end if
    end while
    return res
end function
 
function facto(bigatom n, integer f)
    if f!=0 then
        bigatom nf = ba_sub(n,f)
        while ba_compare(nf,2)>=0 do
            n = ba_mul(n,nf)
            nf = ba_sub(nf,f)
        end while
    end if
    return n
end function

constant test_cases = """
2greatGRo  24Gros  288Doz  1,728pairs  172.8SCOre
1,567  +1.567k  0.1567e-2m
25.123kK  25.123m  2.5123e-00002G
25.123kiKI  25.123Mi  2.5123e-00002Gi  +.25123E-7Ei
-.25123e-34Vikki  2e-77gooGols
9! 9!! 9!!! 9!!!! 9!!!!! 9!!!!!! 9!!!!!!! 9!!!!!!!! 9!!!!!!!!!
0.017k!!
"""
constant tests = split(substitute(test_cases,"\n"," "),no_empty:=true)
 
for i=1 to length(tests) do
    string test = tests[i], suffix = "", facts = ""
    for f=length(test) to 1 by -1 do
        if test[f]!='!' then
            {test,facts} = {test[1..f],test[f+1..$]}
            exit
        end if
    end for
    for d=length(test) to 1 by -1 do
        integer digit = test[d]
        if digit>='0' and digit<='9' then
            {test,suffix} = {test[1..d],test[d+1..$]}
            exit
        end if
    end for
    bigatom n = ba_new(substitute(test,",",""))
    n = ba_mul(n,decode(suffix))
    n = facto(n,length(facts))
    string ns = ba_sprintf("%,B",n)
    printf(1,"%30s : %s\n",{tests[i],ns})
end for
