Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 1372b52

Browse files
rrbutanialexcrichton
authored andcommitted
rustfmt'ed
1 parent 2f163d5 commit 1372b52

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/math/pow.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -595,30 +595,33 @@ mod tests {
595595

596596
#[test]
597597
fn special_cases() {
598-
// / 20. (anything) ** 1 is (anything)
599598
// One as the exponent:
600599
// (anything ^ 1 should be anything - i.e. the base)
601600
test_sets(ALL, &|v: f64| pow(v, 1.0), &|v: f64| v);
602601

603-
// / 21. (anything) ** -1 is 1/(anything)
604602
// Negative One as the exponent:
605603
// (anything ^ -1 should be 1/anything)
606604
test_sets(ALL, &|v: f64| pow(v, -1.0), &|v: f64| 1.0 / v);
607605

608-
// / 22. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
609606
// Factoring -1 out:
610607
// (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))
611-
&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS].iter().for_each(|int_set| int_set.iter().for_each(|int| {
612-
test_sets(ALL, &|v: f64| pow(-v, *int), &|v: f64| pow(-1.0, *int) * pow(v, *int));
613-
}));
608+
&[POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS]
609+
.iter()
610+
.for_each(|int_set| {
611+
int_set.iter().for_each(|int| {
612+
test_sets(ALL, &|v: f64| pow(-v, *int), &|v: f64| {
613+
pow(-1.0, *int) * pow(v, *int)
614+
});
615+
})
616+
});
614617

615-
// / 23. (-anything except 0 and inf) ** (non-integer) is NAN
616618
// Negative base (imaginary results):
617619
// (-anything except 0 and Infinity ^ non-integer should be NAN)
618-
&NEG[1..(NEG.len()-1)].iter().for_each(|set| set.iter().for_each(|val| {
619-
test_sets(&ALL[3..7], &|v: f64| pow(*val, v), &|_| NAN);
620-
}));
621-
620+
&NEG[1..(NEG.len() - 1)].iter().for_each(|set| {
621+
set.iter().for_each(|val| {
622+
test_sets(&ALL[3..7], &|v: f64| pow(*val, v), &|_| NAN);
623+
})
624+
});
622625
}
623626

624627
#[test]

0 commit comments

Comments
 (0)