home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROCS.LZH
/
GMEAN.ICN
< prev
next >
Wrap
Text File
|
1991-07-13
|
692b
|
29 lines
############################################################################
#
# Name: gmean.icn
#
# Title: Compute geometric mean
#
# Author: Gregg M. Townsend
#
# Date: November 10, 1990
#
############################################################################
#
# This procedure computes the geometric mean of an arbitrary number of
# values. It fails if there are no arguments or if any argument is zero.
#
############################################################################
procedure gmean(L[])
local m
m := 1.0
every m *:= !L
m := abs(m)
if m > 0.0 & *L > 0 then
return exp (log(m) / *L)
else
fail
end