API Reference › Math › Math.pow
method

Math.pow

Math.pow(base, exp) -> fixed

Returns baseexp for base > 0 and any fixed exp, computed in Q16.16 as 2exp·log₂base — so non-integer exponents work (Math.pow(x, 0.5) is a square root, though Math.sqrt is cheaper and exact) and it stays bit-identical on every platform. Use it for gameplay curves that need a tunable exponent: damage falloff, easing shaped by a designer-set power, or compound-growth economies. Keep the result inside the fixed range (magnitudes below 32768); combinations that exceed it saturate.

Example

program Demo {
  handler Step phase Update {
    let falloff = Math.pow(0.9, distance)   # each unit keeps 90% of the effect
  }
}
← All symbols