subt_num_vec

Function subt_num_vec 

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

§subt_num_vec(x, y)

Operation Function

The subt_num_vec function subtracts a float x from each element in a slice y of floats, returning a new vector containing the differences.

§Examples

use mathlab::math::{subt, subt_num_vec, fround_vec};
assert_eq!(subt(0.1, 0.2), -0.1);
assert_eq!(subt(0.1, 0.2) as f32, -0.1);
assert_eq!(subt_num_vec(0.1, &[0.0, 0.1, 0.2, 0.3]), [0.1, 0.0, -0.1, -0.19999999999999998]);
assert_eq!(fround_vec(&subt_num_vec(0.1, &[0.0, 0.1, 0.2, 0.3])), [0.1, 0.0, -0.1, -0.2]);

End Fun Doc