Caché MultiValue Basic Reference
PWR
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns a number raised to a power.
Synopsis
PWR(num,exponent)
Arguments
num 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.
exponent The exponent. An expression that resolves to a numeric, specified either as a number or as a numeric string.
Description
The PWR 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 and exponent 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.
Very large positive exponent values (such as PWR(9,153)) or very small num values with a negative exponent (such as PWR(.00005,-30)) may result in an overflow, generating a <MAXNUMBER> error. Very large negative exponent values (such as PWR(9,-135)) or very small num values with a positive exponent (such as PWR(.00005,30)) may result in an underflow, returning 0.
The same operation can be performed using the exponentiation operator: **. To perform exponentiation on the elements of a dynamic array, use the PWRS function.
See Also