home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
forum16.lzh
/
SOFTWARE
/
AWK
/
EXAMPLES
/
rms
< prev
next >
Wrap
Text File
|
1991-05-06
|
407b
|
19 lines
# rms computes the square root of the
# sum of the squares of a set of numbers.
# The set of numbers is provided as input -
# one number to a record.
#
# NR is the current record number. In the END
# section it is the number of records.
BEGIN {
sum_of_squares = 0
}
{
sum_of_squares += $1 * $1
}
END {
root_mean_square = sqrt(sum_of_squares / NR)
print root_mean_square
}