POW(real-expression, real-expression)
Raises the first expression to the power of the second expression and returns the result as a real number.
Examples
Produces 8.
Produces 3 (square root of 9).
Produces 0.0625 (reciprocal of 16).
REM Compute compound interest
principal# = 1000
rate# = 0.05
years = 10
amount# = principal# * POW(1 + rate#, years)
PRINT "Future value = "; amount#
Notes
- The base (first parameter) may be any real number.
- The exponent (second parameter) may also be any real, including fractions and negatives.
- Special cases:
- POW(x, 0) returns 1 (for any x ≠ 0).
- POW(0, y) returns 0 (for y > 0).
- Invalid combinations (e.g. POW(0, 0) or negative base with fractional exponent) may cause errors.
- Related: SQR computes the square root directly.
See also: EXP · LOG · SQR