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.
Unqual!F pow(F, G)(F x, G n) if (isFloatingPoint!(F) && isIntegral!(G)) @nogc @trusted pure nothrowCompute the value of x n, where n is an integer
typeof(Unqual!(F).init * Unqual!(G).init) pow(F, G)(F x, G n) if (isIntegral!(F) && isIntegral!(G)) @nogc @safe pure nothrowCompute the power of two integral numbers.
x | base |
n | exponent |
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.
division by zero.
real pow(I, F)(I x, F y) if (isIntegral!I && isFloatingPoint!F) @nogc @trusted pure nothrowComputes integer to floating point powers.
Unqual!(Largest!(F, G)) pow(F, G)(F x, G y) if (isFloatingPoint!(F) && isFloatingPoint!(G)) @nogc @trusted pure nothrowCalculates 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 |