Exponent Operator (^)
result = number ^ exponent
|result||Any numeric variable.|
|number||Any numeric expression.|
|exponent||Any numeric expression. An exponent value is required.|
The caret (^) is used as the exponentiation operator.
The exponent operator should not be confused with the base-10 exponent symbol. An uppercase letter “E”, or lowercase letter “e” can be used as a base-10 exponent (scientific notation) symbol in a numeric literal. These letters cannot be used as operators.
The number argument can be negative only if exponent is an integer value. When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.
Caché Basic exponentiation is functionally identical to ObjectScript exponentiation. For details on valid argument values and the value returned for specific combinations of argument values, see Exponentiation Operator in the “Operators and Expressions” chapter of Using Caché ObjectScript.
The following example shows valid uses of the exponent operator (^) and the base-10 exponent symbol (E). Note that the usage x E y is not valid, because E is a numeric literal character, not an operator.
SET x=3 SET y=4 Println x ^ y ' Returns 81 Println 3E4 ' Returns 30000