Geometric average: how to compute it: best approach ?




I want to write a very little computer program in which computes the
geometric mean of a large amount n of numbers Xi read from some data
source.Say for istance n = 1,000,000,000,000 numbers.

GM = (X1 * X2 * ... * Xn ) ^ 1/n

GM has the dimension of any of the Xi.

I cannot do all the multiplications first, because the computer will
not hold the result.

Also I guess I cannot apply the exponent to each single Xi before
multiplication because of the large n,
with consequent imprecision and extreme slowness...

How can proceed, say in an incremental way, to compute GM. What is the
best approach.?
Can anyone propose some pseudocode?

-P

.


Loading