rootToInt method
Returns the root of this
factored by factor
as an int
, but
only if this
is a valid power of factor
, otherwise throws an
InvalidPowerException.
Implementation
int rootToInt(num factor) {
final root = this.root(factor);
if (!root.isValidInteger) {
throw (InvalidPowerException(factor, this));
}
return root.toInt();
}