randRange(100, 9999) NUMBER_SEED.toString().length rand(2) === 0 ? randRange(4, 8) : randRange( -1 * NUMBER_SEED_LENGTH - 4, -1 * NUMBER_SEED_LENGTH ) ZEROES + ( NUMBER_SEED_LENGTH - 1 ) NUMBER_SEED / pow( 10, E - ZEROES ) floor( BASE ) ( BASE + "" ).substring( 1 ) ZEROES > 0 ? NUMBER_SEED * pow( 10, ZEROES ) : ( NUMBER_SEED * pow( 10, ZEROES ) ).toFixed( -1 * ZEROES ) commafy( DECIMAL ) BASE + " \\times 10^{" + E + "}" \newcommand{\exponentColor}{\color{purple}{#1}}\newcommand{\leadingColor}{\color{green}{#1}}

Express this number in scientific notation.

PRETTY_DECIMAL

BASE  \times 10  E

There are \exponentColor{E} digits to the right of the leading \leadingColor{LEADING} (and to the left of the decimal).

Count the zeroes to the right of the decimal point before the leading \leadingColor{LEADING}: there is 1 zeroare (E + 1) * -1 zeroes.

If you count the leading digit \leadingColor{LEADING} and those zeroes and the 1 zero, there E === -1 ? "is" : "are" \exponentColor{E * -1} E === -1 ? "digit" : "digits" to the right of the decimal point.

So: PRETTY_DECIMAL = \leadingColor{LEADING}TRAIL \times 10^{\exponentColor{E}}

commafy( pow( 10, E ) )

SCIENTIFIC = {?}

DECIMAL

SCIENTIFIC = BASE \times TEN_POWER

BASE \times TEN_POWER = PRETTY_DECIMAL