Function ringbuffer_iteration::mean[][src]

pub fn mean<T, const N: usize>(buffer: &RingBuffer<T, N>) -> T where
    T: PrimInt
Expand description

Calculate the mean of the values inside buffer.

This implementation upcasts to an i64 in order to prevent any risk of overflow during summation. The result is still returned as the original data type. This only operates over primitive integer types and not floating point numbers due to this upcast logic.