std.math.pow
- multiple declarations
- Function pow
- Function pow
- Function pow
- Function pow
Function pow
Compute the value of x
n
, where n
is an integer
Prototype
Unqual!F pow(F, G)( F x, G n ) pure nothrow @nogc @trusted if (isFloatingPoint!F && isIntegral!G);
Function pow
Compute the value of an integer x
, raised to the power of a positive
integer n
.
If both x
and n
are 0, the result is 1.
If n
is negative, an integer divide error will occur at runtime,
regardless of the value of x
.
Prototype
typeof(Unqual!F.init*Unqual!G. init) pow(F, G)( F x, G n ) pure nothrow @nogc @trusted if (isIntegral!F && isIntegral!G);
Example
immutable int one = 1; immutable byte two = 2; immutable ubyte three = 3; immutable short four = 4; immutable long ten = 10; assert(pow(two, three) == 8); assert(pow(two, ten) == 1024); assert(pow(one, ten) == 1); assert(pow(ten, four) == 10_000); assert(pow(four, 10) == 1_048_576); assert(pow(three, four) == 81);
Function pow
Computes integer to floating point powers.
Prototype
real pow(I, F)( I x, F y ) pure nothrow @nogc @trusted if (isIntegral!I && isFloatingPoint!F);
Function pow
x
y
pow
(x
, y
)x
| > 1x
| < 1x
| > 1x
| < 1Prototype
Unqual!(Largest!(F,G)) pow(F, G)( F x, G y ) pure nothrow @nogc @trusted if (isFloatingPoint!F && isFloatingPoint!G);
Authors
Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw