Skip to content

when calculate centroid, fixed number #9

Description

@maodouchen

TDigest.prototype._addweight = function(nearest, x, n) {
// add weight at location x to nearest centroid. adding x to
// nearest will not shift its relative position in the tree and
// require reinsertion.
//
if (x !== nearest.mean) {
nearest.mean += n * (x - nearest.mean) / (nearest.n + n);
nearest.mean = nearest.mean.toFixed(number) // add this line?
}
nearest.cumn += n;
nearest.mean_cumn += n / 2;
nearest.n += n;
this.n += n;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions