randRange(1, 9) randRange(2, 9)
randRange(1, 9) randRange(2, 9)
randFromArray([1, -1]) randFromArray([1, -1]) NEG1 === -1 ? "-" : "" NEG2 === -1 ? "-" : "" NEG1 * NEG2 * N1 * D2 D1 * N2 getGCD(NUMERATOR, DENOMINATOR)
Reduce to lowest terms:

NEG1S \dfrac{N1}{D1} \div NEG2S \dfrac{N2}{D2} = {?}

NUMERATOR / DENOMINATOR

Dividing by a fraction is the same as multiplying by the reciprocal of the fraction.

The reciprocal of NEG2S \dfrac{N2}{D2} is NEG2S \dfrac{D2}{N2}.

Therefore:

NEG1S \dfrac{N1}{D1} \div NEG2S \dfrac{N2}{D2} = NEG1S \dfrac{N1}{D1} \times NEG2S \dfrac{D2}{N2}

\phantom{NEG1S \dfrac{N1}{D1} \times NEG2S \dfrac{D2}{N2}} = \dfrac{NEG1SN1 \times NEG2SD2}{D1 \times N2}

\phantom{NEG1S \dfrac{N1}{D1} \times NEG2S \dfrac{D2}{N2}} = \dfrac{NUMERATOR}{DENOMINATOR}

The numerator and denominator have a common divisor of GCD, so we can simplify:

\dfrac{NUMERATOR}{DENOMINATOR} = \dfrac{NUMERATOR \div GCD}{DENOMINATOR \div GCD} = fractionReduce(NUMERATOR, DENOMINATOR)