Returns a number raised to a power.
||The base number. An expression that resolves to a numeric, specified either as a number or as a numeric string. If num is 0, exponent must be non-negative. If num is negative, exponent must be an integer.
||The exponent. An expression that resolves to a numeric, specified either as a number or as a numeric string.
function raises num
to the power specified by exponent
. Both numeric values can be expressed as either numbers or as strings. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a non-numeric character is encountered. Thus 7dwarves is parsed as 7. Non-numeric strings and null strings are parsed as 0.
Any non-zero num
raised to an exponent
of 0 returns 1. If num
are both 0, PWR
returns 0. If num
is 0 and exponent
is a negative number, PWR
generates an <ILLEGAL VALUE> error. If num
is a negative number and exponent
is a fractional number, PWR
generates an <ILLEGAL VALUE> error.
The same operation can be performed using the exponentiation operator: **. To perform exponentiation on the elements of a dynamic array, use the PWRS
© 1997-2019 InterSystems Corporation, Cambridge, MA