Skip to main content

percentile_sorted_f64

Function percentile_sorted_f64 

Source
pub fn percentile_sorted_f64(sorted_values: &[f64], p: f64) -> f64
Expand description

SIMD-friendly percentile calculation.

Finds the value at the given percentile (0.0-1.0). Uses linear interpolation for non-integer indices. Values must be sorted in ascending order.

ยงExample

use presentar_core::simd::percentile_sorted_f64;
let sorted = vec![1.0, 2.0, 3.0, 4.0, 5.0];
assert_eq!(percentile_sorted_f64(&sorted, 0.5), 3.0); // median