pwr() Function

The pwr() function raises a value contained in an expression to the power of the value of a second expression.

Syntax

pwr(num.exp, power.exp)

Parameter(s)

num.exp

Value to raise to the power of the value of power.exp.

power.exp  

Value whose power is applied to the value of num.exp.

Description

A power.exp of 0 always returns a 1. A num.exp of 0 returns a 0.

As with all functions that require numeric expressions, if any of the arguments evaluate to a nonnumeric value, this run-time warning message displays:

[b16] in program "pgm", line n: Nonnumeric data when numeric required; zero used.

Example(s)

This statement prints a 9, the result of 3 taken to the power of 2.

print pwr(3,2)

In this statement, 3^2 is identical to pwr(3,2).

print 3^2

This statement prints the square root of the value stored in the variable xyz. This is equivalent to: print sqrt(xyz)

print pwr(xyz,.5)

See Also

BASIC Functions,, Statements and Functions, ^ Arithmetic Operator