Logo

Programming-Idioms

  • Rust
  • Dart

Idiom #336 Exponent

Compute x = b

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

final x = b ** n;

raise base to the exponent power.
let x = b.pow(n)
Value := Base ** Exponent;

Exponent's type must be an Integer >= 0 (Natural). Or, if Base is a floating point number, Exponent can be negative.

New implementation...