home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # File: gmean.icn
- #
- # Subject: Procedure to 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
-