Note: Built-In Function Rules Usage Options
Performs exponentiation by raising a base number to an exponent.
Arguments
|
Return Values
|
Examples
Calculate 2.345 raised to the power of 5.67 accurate to five decimal positions:
USE BUILTIN(EXPONENTIAL) WITH_ARGS(2 0.345 5 0.67)
TO_GET(#DIGITS #DECIMALS)
CHANGE FIELD(#RESULT) TO('#DIGITS + #DECIMALS')
Read a packed decimal 15,5 base and a packed decimal 5,2 exponent from a workstation and display the result to the user as a packed decimal 15,5:
DEFINE FIELD(#BASE) TYPE(*DEC) LENGTH(15) DECIMALS(5) LABEL('Base :') EDIT_CODE(3)
DEFINE FIELD(#EXPN) TYPE(*DEC) LENGTH(5) DECIMALS(2) LABEL('Exponent :') EDIT_CODE(3)
DEFINE FIELD(#RDGT) TYPE(*DEC) LENGTH(10) DECIMALS(0)
DEFINE FIELD(#RDEC) TYPE(*DEC) LENGTH(5) DECIMALS(5)
DEFINE FIELD(#RSLT) TYPE(*DEC) LENGTH(15) DECIMALS(5) LABEL('Result :') EDIT_CODE(3)
REQUEST FIELDS(#BASE #EXPN)
USE BUILTIN(EXPONENTIAL) WITH_ARGS(#BASE #BASE #EXPN #EXPN) TO_GET(#RDGT #RDEC)
CHANGE FIELD(#RSLT) TO('#RDGT + #RDEC')
DISPLAY FIELDS(#BASE #EXPN #RSLT)