pow

fnUnqual!F pow(F, G)(F x, G n) if (isFloatingPoint!(F) && isIntegral!(G)) @nogc @trusted pure nothrow

Compute the value of x n, where n is an integer

fntypeof(Unqual!(F).init * Unqual!(G).init) pow(F, G)(F x, G n) if (isIntegral!(F) && isIntegral!(G)) @nogc @safe pure nothrow

Compute the power of two integral numbers.

Parameters

xbase
nexponent

Returns

x raised to the power of n. If n is negative the result is 1 / pow(x, -n),

which is calculated as integer division with remainder. This may result in a division by zero error.

If both x and n are 0, the result is 1.

Throws

If x is 0 and n is negative, the result is the same as the result of a

division by zero.

fnreal pow(I, F)(I x, F y) if (isIntegral!I && isFloatingPoint!F) @nogc @trusted pure nothrow

Computes integer to floating point powers.

fnUnqual!(Largest!(F, G)) pow(F, G)(F x, G y) if (isFloatingPoint!(F) && isFloatingPoint!(G)) @nogc @trusted pure nothrow

Calculates xy.

x y pow(x, y) div 0 invalid?
anything ±0.0 1.0 no no
|x| ≥ 1 +∞ +∞ no no
|x| < 1 +∞ +0.0 no no
|x| ≥ 1 -∞ +0.0 no no
|x| < 1 -∞ +∞ no no
+∞ ≥ 0.0 +∞ no no
+∞ < 0.0 +0.0 no no
-∞ odd integer ≥ 0.0 -∞ no no
-∞ ≥ 0.0, not odd integer +∞ no no
-∞ odd integer < 0.0 -0.0 no no
-∞ < 0.0, not odd integer +0.0 no no
±1.0 ±∞ -NaN no yes
< 0.0 finite, nonintegral NaN no yes
±0.0 odd integer < 0.0 +∞ yes no
±0.0 < 0.0, not odd integer +∞ yes no
±0.0 odd integer ≥ 0.0 ±0.0 no no
±0.0 ≥ 0.0, not odd integer +0.0 no no