# PWR

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

Tags: mathematical operations

# Description

The PWR function raises a number to the n'th power. It takes the general form:

PWR(expression1, expression2)
1

or

expression1 ^ expression2
1

Where both expression1 and expression2 should evaluate to numeric arguments. The function will return the value of expression1 raised to the value of expression2.

# Note

If expression1 is negative and expression2 is not an integer then a maths library error is displayed and the function returns the value 0. The error message displayed is:

pow: DOMAIN error

All calculations are performed at the maximum precision supported on the host machine and truncated to the compiled precision on completion.

Examples of use may be as:

A = 4
B = 31
CRT "4 GB is ":A^B
1
2
3

or

A = 4
B = 31
CRT "4 GB is": PWR(A, B)
1
2
3

Go back to jBASE BASIC

Go back to Programmers' Reference Guide