pow - Power Function

Prev Next

Function Names

pow

Description

Calculates the x (base value) ^ y (power exponent).

Vectorization: This function supports vectorization in the 1st and 2nd function parameters. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st and 2nd function parameters

Parameter count

2

Parameters

No.TypeDescription
1
input
numeral
set
Base value

Value or set containing values (vectorization) to be raised to the power exponent

2
input
numeral
set
Exponent

Exponent Value or set containing values (vectorization)

Default value: 1

Return value

TypeDescription
numeral
set
Result

Calculated result

Exceptions

Value provided is not a numeral
rounding intervals is negative or zero

Examples

               echo( pow( 7, 2 ) );
               echo( pow( 3, 3 ) );
               echo( pow( 81, 0.5 ) );
               echo( pow( 27, 1/3 ) );
               echo( pow( 2, {2,3} ) ); // Vectorized
               echo( pow( {2,3}, 2 ) ); // Vectorized
               echo( pow( {2,3}, {3,4} ) ); // Vectorized both parameters

Output

49
27
9
3
{4,8}
{4,9}
{8,81}
Try it yourself: Open LIB_Function_pow.b4p in B4P_Examples.zip. Decompress before use.

See also

Square Root