Let the standard deviation of the empty set be 0. This is consistent with
the behaviour for averages, and fixes a crash that can occur when attempting to print a stddev aggregation containing no elements: dtrace:::BEGIN { @ = stddev(0); clear(@); printa("%@d", @); } PR: 197260 MFC after: 2 week
This commit is contained in:
parent
174b32ced4
commit
6ac0e4858a
@ -382,6 +382,9 @@ dt_stddev(uint64_t *data, uint64_t normal)
|
||||
int64_t norm_avg;
|
||||
uint64_t diff[2];
|
||||
|
||||
if (data[0] == 0)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* The standard approximation for standard deviation is
|
||||
* sqrt(average(x**2) - average(x)**2), i.e. the square root
|
||||
|
Loading…
Reference in New Issue
Block a user