Skip to main content

range

Function range 

Source
pub fn range(data: &[f64]) -> f64
Expand description

Calculates the range (max - min) of a slice of f64 values.

§Arguments

  • data - Slice of f64 values

§Returns

The range as f64, or NaN if the slice is empty

§Examples

use linreg_core::stats::range;

let data = vec![3.0, 1.0, 4.0, 1.0, 5.0, 9.0];
assert_eq!(range(&data), 8.0);  // 9.0 - 1.0