Consider the following operation:
$\left(\frac{a}{b}\right)^\frac{n}{m}$
where $a, n\in\mathbb{Z}$ and $b, m\in\mathbb{N^*}$.
My question is: when the result is a rational number, how (formula or algorithm) do you compute $c\in\mathbb{Z}, d\in\mathbb{N^*}$ in:
$\frac{c}{d}=\left(\frac{a}{b}\right)^\frac{n}{m}$