compound

Computes (1 + x)n where n is an integer

@IEEECompliant("compound", 42)
compound
(
D
)
(
auto const ref D x
,
const int n
)

Throws

InvalidOperationExceptionx is signaling NaN or x < -1.0
DivisionByZeroExceptionx = -1.0 and n < 0
OverflowExceptionresult is too big to be represented
UnderflowExceptionresult is too small to be represented
InexactExceptionthe result is inexact

Special values

xncompound(x, n)
sNaNanyNaN
any0+1.0
-1.0<0+∞
-1.0>0+0.0
+∞any+∞

Examples

decimal32 x = "0.2";
assert (compound(x, 2) == decimal32("1.44"));

Meta