9.199 SQUARE_ROOT

Note: Built-In Function Rules     Usage Options

Calculates a square root value.

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Value to have square root calculated.

Note: In Visual LANSA the maximum length is 15,5

1

30

0

9

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

N

Req

Square root value.

Note: In Visual LANSA the maximum length is 15,5

1

30

0

9

 

Note: This function will truncate the root value into the return value. That is, if the return field is defined as digits(4) decimals(2) and the value of the square root is 1.41421, the value returned will be 01.41.

Examples

********** A simple square root calculator

DEFINE     FIELD(#NUMBER1) TYPE(*DEC) LENGTH(15) DECIMALS(5) EDIT_CODE(3)

DEFINE     FIELD(#RESULT) TYPE(*DEC) LENGTH(15) DECIMALS(5) EDIT_CODE(3)

********** Request number to calculate root from

REQUEST    FIELDS(#NUMBER1)

********** Calculate square root

USE        BUILTIN(SQUARE_ROOT) WITH_ARGS(#NUMBER1) TO_GET(#RESULT)

********** Display result

DISPLAY   FIELDS(#NUMBER1 #RESULT)