9 88 EXPONENTIAL

LANSA Technical

9.88 EXPONENTIAL

Þ Note: Built-In Function Rules.

Performs exponentiation by raising a base number to an exponent.

For use with

LANSA for i

YES

Not available for RDMLX.

Visual LANSA for Windows

NO

 

Visual LANSA for Linux

NO

 

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Base digit portion Decimal portion and digits beyond 13th position ignored.

1

15

0

9

2

N

Req

Base decimal portion Digit portion and decimals beyond 5th position ignored.

1

15

0

9

3

N

Req

Exponent digit portion Decimal portion and digits beyond 13th position ignored.

1

15

0

9

4

N

Req

Exponent decimal portion Digit portion and decimals beyond 5th position ignored.

1

15

0

9

5

A

Opt

Rounding of result required:
Values: Y or N

Default: N

Note: rounding is at the 5th decimal position.

1

1

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Result digit portion Accurate to 13 digits.

1

15

0

9

2

N

Req

Result decimal portion Accurate to 5 decimals.

1

15

0

9

3

A

Opt

Return code
Values:
Y = good return
N = error occurred

1

1

 

 

 

 

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)