Skip to main content

log2_vec

Function log2_vec 

Source
pub fn log2_vec(x: &[f64]) -> Vec<f64>
Expand description

§log2_vec(x)

Logarithm Function

The log2_vec function applies the base-2 logarithm to each element of x, returning a new vector containing the results of these computations.

§Examples

use mathlab::math::{log2, log2_vec, is_nan_f64, E, INF_F64 as inf, LN10};
assert!(is_nan_f64(log2(-inf)));
assert_eq!(log2(0.0), -inf);
assert_eq!(log2(1.0), 0.0);
assert_eq!(log2(E), 1.4426950408889634);
assert_eq!(log2_vec(&[0.0, 1.0, E, LN10]), &[-inf, 0.0, 1.4426950408889634, 1.2032544726997219]);

End Fun Doc