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 anint
, but only ifthis
is a valid cube, otherwise throws an InvalidPowerException. -
rootToInt(
num factor) → int -
Returns the root of
this
factored byfactor
as anint
, but only ifthis
is a valid power offactor
, otherwise throws an InvalidPowerException. -
sqrtToInt(
) → int -
Returns the square root of
this
as anint
, but only ifthis
is a valid square, otherwise throws an InvalidPowerException.