pub fn stddev(nums: &[f64]) -> Option<f64> {
    if nums.is_empty() {
        None
    } else if nums.len() == 1 {
        Some(0.0)
    } else {
        let avg = mean(nums).unwrap();
        let mut sums = Vec::new();
        for i in &nums[..] {
            sums.push((i - avg).powf(2.0));
        }
        Some(mean(&sums[..]).unwrap().sqrt())
    }
}
/// Population standard deviation of input values. The
/// standard deviation of an empty list is undefined.
///
/// # Examples:
///
/// ```
/// # use stats::*;
/// assert_eq!(None, stddev(&[]));
/// ```
/// ```
/// # use stats::*;
/// assert_eq!(Some(0.0), stddev(&[1.0, 1.0]));
/// ```
/// ```
/// # use stats::*;
/// assert_eq!(Some(0.0), stddev(&[1.0]));
/// ```
Population standard deviation of input values. The
standard deviation of an empty list is undefined.
Population standard deviation of input values . The standard deviation of an empty list is undefined .
pub fn stddev(nums: &[f64]) -> Option<f64> {
    if nums.is_empty() {
        None
    } else if nums.len() == 1 {
        Some(0.0)
    } else {
        let avg = mean(nums).unwrap();
        let mut sums = Vec::new();
        for i in &nums[..] {
            sums.push((i - avg).powf(2.0));
        }
        Some(mean(&sums[..]).unwrap().sqrt())
    }
}
pub fn stddev ( nums : & [ f64 ] ) -> Option < f64 > { if nums . is_empty ( ) { None } else if nums . len ( ) == 1 { Some ( 0.0 ) } else { let avg = mean ( nums ) . unwrap ( ) ; let mut sums = Vec :: new ( ) ; for i in & nums [ .. ] { sums . push ( ( i - avg ) . powf ( 2.0 ) ) ; } Some ( mean ( & sums [ .. ] ) . unwrap ( ) . sqrt ( ) ) } }
Population standard deviation of input values.
Population standard deviation of input values .
nums
&[f64]
nums
&[f64]
examples:
None
use stats::*;
None
use stats::*;
None
use stats::*;
None