Rollup merge of #129321 - krtab:float_sum, r=workingjubilee · patricklam/verify-rust-std@77bd65f (original) (raw)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
1 +#[test]
2 +fn f32_ref() {
3 +let x: f32 = -0.0;
4 +let still_x: f32 = [x].iter().sum();
5 +assert_eq!(1. / x, 1. / still_x)
6 +}
7 +
8 +#[test]
9 +fn f32_own() {
10 +let x: f32 = -0.0;
11 +let still_x: f32 = [x].into_iter().sum();
12 +assert_eq!(1. / x, 1. / still_x)
13 +}
14 +
15 +#[test]
16 +fn f64_ref() {
17 +let x: f64 = -0.0;
18 +let still_x: f64 = [x].iter().sum();
19 +assert_eq!(1. / x, 1. / still_x)
20 +}
21 +
22 +#[test]
23 +fn f64_own() {
24 +let x: f64 = -0.0;
25 +let still_x: f64 = [x].into_iter().sum();
26 +assert_eq!(1. / x, 1. / still_x)
27 +}