You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#6043 - HaramanJohal:margin_of_error, r=matthiaskrgr
clarify margin of error in wording of float comparison operator lint messages
fixesrust-lang#6040
changelog: change wording of float comparison operator to make margin of error less ambiguous
Copy file name to clipboardExpand all lines: tests/ui/float_cmp.stderr
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,50 +2,50 @@ error: strict comparison of `f32` or `f64`
2
2
--> $DIR/float_cmp.rs:65:5
3
3
|
4
4
LL | ONE as f64 != 2.0;
5
-
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
5
+
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin`
6
6
|
7
7
= note: `-D clippy::float-cmp` implied by `-D warnings`
8
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
8
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
9
9
10
10
error: strict comparison of `f32` or `f64`
11
11
--> $DIR/float_cmp.rs:70:5
12
12
|
13
13
LL | x == 1.0;
14
-
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
14
+
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 1.0).abs() < error_margin`
15
15
|
16
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
16
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
17
17
18
18
error: strict comparison of `f32` or `f64`
19
19
--> $DIR/float_cmp.rs:73:5
20
20
|
21
21
LL | twice(x) != twice(ONE as f64);
22
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error`
22
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(twice(x) - twice(ONE as f64)).abs() > error_margin`
23
23
|
24
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
24
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
25
25
26
26
error: strict comparison of `f32` or `f64`
27
27
--> $DIR/float_cmp.rs:93:5
28
28
|
29
29
LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j];
30
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error`
30
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin`
31
31
|
32
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
32
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
33
33
34
34
error: strict comparison of `f32` or `f64` arrays
35
35
--> $DIR/float_cmp.rs:98:5
36
36
|
37
37
LL | a1 == a2;
38
38
| ^^^^^^^^
39
39
|
40
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
40
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
41
41
42
42
error: strict comparison of `f32` or `f64`
43
43
--> $DIR/float_cmp.rs:99:5
44
44
|
45
45
LL | a1[0] == a2[0];
46
-
| ^^^^^^^^^^^^^^ help: consider comparing them within some error: `(a1[0] - a2[0]).abs() < error`
46
+
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(a1[0] - a2[0]).abs() < error_margin`
47
47
|
48
-
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error`
48
+
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
0 commit comments