home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
TOOLKIT
/
CREXX
/
REXXCALC
/
PROGRAM6.CAL
< prev
next >
Wrap
Text File
|
1994-11-17
|
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))