pub fn add_vec_num(x: &[f64], y: f64) -> Vec<f64>
Expand description
§add_vec_num(x, y)
Operation Function
The add_vec_num
function takes a slice x
of floating-point numbers and a float y
,
performs an element-wise addition on all elements of x
and y
, and returns a new vector containing the resulting sums.
§Examples
use mathlab::math::{add, add_vec_num, fround_vec};
assert_eq!(add(0.1, 0.2), 0.30000000000000004);
assert_eq!(add(0.1, 0.2) as f32, 0.3);
assert_eq!(add_vec_num(&[0.0, 0.1, 0.2], 0.1), [0.1, 0.2, 0.30000000000000004]);
assert_eq!(fround_vec(&add_vec_num(&[0.0, 0.1, 0.2], 0.1)), [0.1, 0.2, 0.3]);
End Fun Doc