RootToInt extension

Adds methods to return the root of a value as an int.

The methods will only work if this is the power of a valid integer.

on

Methods

cbrtToInt() int
Returns the cube root of this as an int, but only if this is a valid cube, otherwise throws an InvalidPowerException.
rootToInt(num factor) int
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.
sqrtToInt() int
Returns the square root of this as an int, but only if this is a valid square, otherwise throws an InvalidPowerException.