fredrick / gauss

JavaScript statistics, analytics, and data library - Node.js and web browser ready
https://npmjs.org/package/gauss
Other
433 stars 29 forks source link

Issue calculating geometric mean #23

Closed felixsanz closed 9 years ago

felixsanz commented 10 years ago

When you push a value 0 into the array and then use .gmean(), it always return 0, no matter what other pushed values are.

To avoid it, i must convert my 0 into 0.0001.

Is this an expected behaviour? thanks

fredrick commented 10 years ago

Thanks for the bug report; I do not believe this is desired behavior, but will investigate further.

felixsanz commented 10 years ago

an example would be:

var foo = new Vector;
foo.push([0, 2, 4, 6, 50]);
foo.gmean(); // returns 0

VS

var foo = new Vector;
foo.push([0.00001, 2, 4, 6, 50]);
foo.gmean(); // returns geometric mean, different than 0 probably in this case