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

View File

@ -83,7 +83,7 @@ impl Variance0 {
/// This is an unbiased estimator of the variance of the population.
#[inline]
pub fn sample_variance(&self) -> f64 {
if self.avg.len() < 1 + ddof as usize {
if self.avg.len() < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
@ -95,7 +95,7 @@ impl Variance0 {
#[inline]
pub fn population_variance(&self) -> f64 {
let n = self.avg.len();
if n < 1 + ddof as usize {
if n < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(n).unwrap()

View File

@ -83,7 +83,7 @@ impl Variance1 {
/// This is an unbiased estimator of the variance of the population.
#[inline]
pub fn sample_variance(&self) -> f64 {
if self.avg.len() < 1 + ddof as usize {
if self.avg.len() < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
@ -95,7 +95,7 @@ impl Variance1 {
#[inline]
pub fn population_variance(&self) -> f64 {
let n = self.avg.len();
if n < 1 + ddof as usize {
if n < 1 + ddof as u64 {
return 0.;
}
self.sum_2 / f64::approx_from(n).unwrap()