randRange(2, 3) _.map(_.range(N), function() { return randFromArray(["decimal", "percentage", "fraction", "fraction"]); }).slice(0, N) _.map(TYPES, function(x) { return randFromArray([2, 4, 5, 8, 10, 20, 25, 50, 100]); }) _.map(DENOMINATORS, function(d) { return randRangeNonZero(-d, d); }) _.map(DENOMINATORS, function(d, i) { return roundTo(3, NUMERATORS[i] / d); }) _.map(TYPES, function(t, i) { if (t === "fraction") { return fraction(NUMERATORS[i], DENOMINATORS[i]); } else if (t === "percentage") { return round(100 * DECIMALS[i]) + "\\%"; } else { return DECIMALS[i]; } }) _.map(DENOMINATORS, function(d, i) { return getGCD(d, NUMERATORS[i]); }) (function() { var arr = []; for (var i = 0; i < N; i++) { if (TYPES[i] !== 'decimal') { arr.push(i); } } return arr; })() (function() { var x = 1; for (var i = 0; i < N; i++) { x *= NUMERATORS[i] / DENOMINATORS[i]; } return roundTo(6, x); })()
(function() { var arr = []; for (var i = 0; i < N; i++) { if (TYPES[i] !== 'decimal') { arr.push(i); } } return arr; })()

Solve the following expression and give your answer as a decimal.

NUMS[0] \times NUMS[1] \times NUMS[2] = {?}

SOLUTION
First get all of the numbers in decimal form.

\qquadNUMS[i] = DECIMALS[i]

\qquad NUMS[i] = fraction(round(NUMERATORS[i] * 100 / DENOMINATORS[i]), 100) = DECIMALS[i]

Now we have:

\qquad DECIMALS[0] \times DECIMALS[1] \times DECIMALS[2] = {?}

\qquad DECIMALS[0] \times DECIMALS[1] \times DECIMALS[2] = SOLUTION

(function() { var arr = []; for (var i = 0; i < N; i++) { if (TYPES[i] !== 'percentage') { arr.push(i); } } return arr; })()

Solve the following expression and give your answer as a percentage.

NUMS[0] \times NUMS[1] \times NUMS[2] = {?}

SOLUTION
First get all of the numbers as percentages.

\qquadNUMS[i] \times 100\% = roundTo(2, 100 * DECIMALS[i])\%

Now we have:

\qquad roundTo(2, 100 * DECIMALS[0])\% \times roundTo(2, 100 * DECIMALS[1])\% \times roundTo(2, 100 * DECIMALS[2])\% = {?}

\qquad roundTo(2, 100 * DECIMALS[0])\% \times roundTo(2, 100 * DECIMALS[1])\% \times roundTo(2, 100 * DECIMALS[2])\% = 100 * SOLUTION \%

(function() { var arr = []; for (var i = 0; i < N; i++) { if (TYPES[i] !== 'fraction' || GCDS[i] !== 1) { arr.push(i); } } return arr; })() _.map(DECIMALS, function(d, i) { if (TYPES[i] === 'decimal' && abs(round(d * 100) - d * 100) < 10e-9) { return 10; } else { return 100; } }) _.map(NUMERATORS, function(n, i) { return round(n / GCDS[i]); }) _.map(DENOMINATORS, function(d, i) { return round(d / GCDS[i]); }) (function() { var n = 1; var d = 1; for (var i = 0; i < N; i++) { n *= SIMPLE_NUMERATORS[i]; d *= SIMPLE_DENOMINATORS[i]; } return [n, d]; })()

Solve the following expression and give your answer as a fraction.

NUMS[0] \times NUMS[1] \times NUMS[2] = {?}

SOLUTION
First get all of the numbers as simplified fractions.

\qquad NUMS[i] = fraction(roundTo(i, POWER[i] * DECIMALS[i]), POWER[i]) = fraction(SIMPLE_NUMERATORS[i], SIMPLE_DENOMINATORS[i])

Now we have:

\qquad fraction(SIMPLE_NUMERATORS[0], SIMPLE_DENOMINATORS[0]) \times fraction(SIMPLE_NUMERATORS[1], SIMPLE_DENOMINATORS[1]) \times fraction(SIMPLE_NUMERATORS[2], SIMPLE_DENOMINATORS[2]) = {?}

\qquad \phantom{ fraction(SIMPLE_NUMERATORS[0], SIMPLE_DENOMINATORS[0]) \times fraction(SIMPLE_NUMERATORS[1], SIMPLE_DENOMINATORS[1]) \times fraction(SIMPLE_NUMERATORS[2], SIMPLE_DENOMINATORS[2])} = \dfrac{SIMPLE_NUMERATORS[0] \times SIMPLE_NUMERATORS[1] \times SIMPLE_NUMERATORS[2]} {SIMPLE_DENOMINATORS[0] \times SIMPLE_DENOMINATORS[1] \times SIMPLE_DENOMINATORS[2]}

\qquad \phantom{ fraction(SIMPLE_NUMERATORS[0], SIMPLE_DENOMINATORS[0]) \times fraction(SIMPLE_NUMERATORS[1], SIMPLE_DENOMINATORS[1]) \times fraction(SIMPLE_NUMERATORS[2], SIMPLE_DENOMINATORS[2])} = fraction(NUMERSOL, DENOMSOL) = fractionReduce(NUMERSOL, DENOMSOL)