Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let vector = vec![1.01_f64, 1.02, 1.03, 1.01, 1.05];
- let difference: Vec<f64> = vector.windows(2).map(|slice| slice[0] - slice[1]).map(|x| (x * 100.0).round() / 100.0).collect();
- println!("{:?}", difference);
- }
Add Comment
Please, Sign In to add comment