9 222 SQUARE_ROOT

LANSA Technical

9.222 SQUARE_ROOT

Þ Note: Built-In Function Rules.

Calculates a square root value.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

YES

 

 

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)