This commit is contained in:
Andrea Cavalli 2019-12-02 13:01:19 +01:00
parent 5f341bc144
commit 538587b81f
2 changed files with 2 additions and 2 deletions

View File

@ -86,7 +86,7 @@ impl Variance0 {
if self.avg.len() < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
self.sum_2 / f64::approx_from(self.avg.len() - ddof as u64).unwrap()
}
/// Calculate the population variance of the sample.

View File

@ -86,7 +86,7 @@ impl Variance1 {
if self.avg.len() < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
self.sum_2 / f64::approx_from(self.avg.len() - ddof as u64).unwrap()
}
/// Calculate the population variance of the sample.