home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
viscobv6.zip
/
vac22os2
/
ibmcobol
/
samples
/
toolkit
/
rexx
/
api
/
rexxcalc
/
program5.cal
< prev
next >
Wrap
Text File
|
1996-11-19
|
1KB
|
24 lines
/* Rexx Calculator program 4 key - standard deviation of memory */
parse arg num /* get the count of memories */
numeric digits CalcPrecision() /* set current precision */
numeric form value CalcForm() /* set current form */
if \datatype(num, 'Whole') /* must be whole number */
then return 'Error' /* return error indicator */
if num < 1 | num >50 /* valid for counter */
then return 'Error' /* return error indicator */
mean = program3(num) /* get the mean */
accumulator = 0 /* start at zero */
do i = 1 to num /* loop for given number */
'GET' i 'REGISTER' /* get next register */
/* add to total */
accumulator = accumulator + (register - mean)**2
end
/* return standard deviation */
return program2(accumulator / (num - 1))