Abstraction of numeric types that may be raised
to a power using the exponentiation operator x ^ n
which accepts an instance of Exponentiable
as its first
operand, and an exponent as its second operand.
function exp(Float x) => e^x;
The exponentiation operation should obey the usual index laws, including:
x^0 == 1
x^1 == x
x^(-1) == 1/x
x^(m+n) == x^m * x^n
x^(m-n) == x^m / x^n
x^(m*n) == (x^m)^n
(x*y)^n == x^n * y^n
where 0
is the additive identity, and 1
is the
multiplicative identity.
Note that in general, the type of the exponent may be
different to the numeric type which is exponentiated. For
example, a Rational
number class might be a subtype of
Exponentiable<Rational,Integer>
, thus accepting only
whole-number exponents.
no type hierarchy
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Invertible<Other> |
Methods | |
power | Source Codeshared formal This power(Other other) The result of raising this number to the given power. |
Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Invertible<Other> |
Methods inherited from: Numeric<Other> |
Methods inherited from: Summable<Other> |