Logo

Programming-Idioms

  • Groovy
  • Pascal
  • Scheme
  • Ada

Idiom #336 Exponent

Compute x = b

b raised to the power of n is equal to the product of n terms b × b × ... × b

Value := Base ** Exponent;

Exponent's type must be an Integer >= 0 (Natural). Or, if Base is a floating point number, Exponent can be negative.
X := Power(B, N);
final x = b ** n;

raise base to the exponent power.

New implementation...