Commit c33ac44d authored by Alfredo Altamirano's avatar Alfredo Altamirano Committed by Facebook Github Bot

Assert that we can't construct centroid with weight <= 0

Summary:
We should not be able to create tdigest centroids with weight <= 0.
Added a debug assert to ensure this.

Differential Revision: D8786969

fbshipit-source-id: 738f2c8d00596365363ea7be88c759da881ab770
parent c0efc2be
......@@ -51,7 +51,9 @@ class TDigest {
class Centroid {
public:
explicit Centroid(double mean = 0.0, double weight = 1.0)
: mean_(mean), weight_(weight) {}
: mean_(mean), weight_(weight) {
DCHECK_GT(weight, 0);
}
inline double mean() const {
return mean_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment