Apply suggestions from code review

Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
This commit is contained in:
Devon Hollowood
2022-10-27 18:20:50 -07:00
committed by GitHub
parent 3739372d43
commit fa50056fce

View File

@@ -331,7 +331,7 @@ mod math {
};
let mut norm = v
.iter()
.cloned()
.copied()
.map(|x| x / scale)
.reduce(accurate_hypot)
.unwrap_or_default();
@@ -342,9 +342,8 @@ mod math {
// approximation of the square root of that to `norm`.
let correction = v
.iter()
.cloned()
.map(|x| x / scale)
.map(|x| x * x)
.copied()
.map(|x| (x / scale).pow(2))
.chain(std::iter::once(-norm * norm))
.tree_fold1(std::ops::Add::add)
.unwrap();