Skip to content

base [terminology]

Terminology

Usage

  • Use for the current multiplicative base in exponentiation.
  • Do not shorten it to b when another operand or bit variable could be confused with it.
  • It differs from ans: base is repeatedly squared, while ans accumulates selected powers.
ans = 1.0
base = x

while n:
    if n & 1:
        ans *= base
    base *= base
    n >>= 1