Convert fraction( I_NUM, I_DENOM, false, true )
to a mixed number.
I_NUM / I_DENOM
First, divide the numerator by the denominator.
I_NUM \div I_DENOM = \color{#28AE7B}{WHOLE}\ \text{ R } \color{purple}{M_REDUCED_NUM}
So the improper fraction has WHOLE
wholes in it, which is equal to \color{#28AE7B}{WHOLE} \times \dfrac{I_DENOM}{I_DENOM} = \color{#28AE7B}{fraction( I_DENOM * WHOLE, I_DENOM, false, false )}
.
This quotient WHOLE
is the whole number part of the mixed number.
We also have a remainder of M_REDUCED_NUM
, though. That represents the \dfrac{\color{purple}{M_REDUCED_NUM}}{I_DENOM}
remaining from the improper fraction; it wasn't enough to be another whole number.
The converted mixed fraction is \color{#28AE7B}{WHOLE}\ \color{purple}{fraction( M_NUM, M_DENOM, false, true )}.
Note that if we add up the two pieces of our mixed fraction, \color{#28AE7B}{fraction( I_DENOM * WHOLE, I_DENOM, false, false )} + \color{purple}{fraction( M_NUM, M_DENOM, false, true )}
, we get the original improper fraction fraction( I_NUM, I_DENOM, false, true )
.
Convert WHOLE\ fraction( M_NUM, M_DENOM, false, true )
to an improper fraction.
I_NUM / I_DENOM
\color{#FFA500}{WHOLE}\ \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}
This mixed number is equivalent to \color{#FFA500}{WHOLE} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}
.
First, convert the whole part of the mixed number to a fraction with the same denominator M_REDUCED_DENOM
as the fractional part.
\color{#FFA500}{WHOLE} \times \dfrac{M_REDUCED_DENOM}{M_REDUCED_DENOM} = \color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}}
So now we have our number in the form \color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}
.
Now, just add the two fractions and simplify!
\color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )} = fraction( I_NUM, I_DENOM, true, true )