Exponentiation (**) operator

Exponentiation (**) operator returns the result of raising the left operand to the power represented by the integer part of the right operand.

Before converting to DECIMAL for evaluation, 4gl converts the right-hand operand of the exponentiation operator to INTEGER. Any fractional part is discarded.

MAIN

DEFINE int_r INTEGER

DEFINE dec_r DECIMAL(8, 2)

 

LET int_r = 12

LET dec_r= 123.12

 

DISPLAY "Integer ** Integer: ", int_r, " ** -1 = ", int_r ** -1 USING "<<<<<&"

DISPLAY "Integer ** Integer: ", int_r, " ** 0 = ", int_r ** 0 USING "<<<<<&"

DISPLAY "Integer ** Integer: ", int_r, " ** 5 = ", int_r ** 5 USING "<<<<<&"

DISPLAY "Integer ** Decimal: ", int_r, " ** 5.12 = ", int_r ** 5.12 USING"<<<<<&"

DISPLAY "Decimal ** Integer: ", dec_r, " ** -1 = ", dec_r ** -1 USING "<<<<<&.&&"

DISPLAY "Decimal ** Integer: ", dec_r, " ** 0 = ", dec_r ** 0 USING "<<<<<&.&&"

DISPLAY "Decimal ** Integer: ", dec_r, " ** 5 = ", dec_r ** 5

DISPLAY "Decimal ** Decimal: ", dec_r, " ** 5.12 = ", dec_r ** 5.12

 

CALL fgl_getkey()

END MAIN

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.