Exponent Operator (^) | Caché Basic Reference | Caché & Ensemble 2018.1.4 – 2018.1.9 (2024)

Used to raise a number to the power of an exponent.

Synopsis

result = number ^ exponent

Arguments

resultAny numeric variable.
numberAny numeric expression.
exponentAny numeric expression. An exponent value is required.

Description

The caret (^) is used as the exponentiation operator.

Note:

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.

Example

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=3SET y=4Println x ^ y ' Returns 81Println 3E4 ' Returns 30000

See Also

FeedbackOpens in a new tab
Exponent Operator (^) | Caché Basic Reference | Caché & Ensemble 2018.1.4 – 2018.1.9 (2024)
Top Articles
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 5991

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.