mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Apply suggestions from code review
Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
This commit is contained in:
1 parent
3739372d43
commit
fa50056fce
1 file changed
+3
-4
+3
-4
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user