Handling zeros in geometric mean calculation