Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tdigest.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
if (histogram->nodes_mean) {
__td_free((void *)(histogram->nodes_mean));
}
if (histogram->nodes_weight) {

Check warning on line 197 in src/tdigest.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Branch condition evaluates to a garbage value

See more on https://sonarcloud.io/project/issues?id=RedisBloom_t-digest-c&issues=AZ-kbC0fw_wH8xCQ2EOx&open=AZ-kbC0fw_wH8xCQ2EOx&pullRequest=33
__td_free((void *)(histogram->nodes_weight));
}
__td_free((void *)(histogram));
Expand Down Expand Up @@ -412,11 +412,11 @@
double td_quantile(td_histogram_t *h, double q) {
td_compress(h);
// q should be in [0,1]
if (q < 0.0 || q > 1.0 || h->merged_nodes == 0) {
if (q < 0.0 || q > 1.0 || h->merged_nodes + h->unmerged_nodes == 0) {
return NAN;
}
// with one data point, all quantiles lead to Rome
if (h->merged_nodes == 1) {
if (h->merged_nodes + h->unmerged_nodes == 1) {
return h->nodes_mean[0];
}

Expand Down