]> git.lizzy.rs Git - rust.git/blob - tests/ui/float_cmp.stderr
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / float_cmp.stderr
1 error: strict comparison of f32 or f64
2   --> $DIR/float_cmp.rs:43:5
3    |
4 43 |     ONE == 1f32;
5    |     ^^^^^^^^^^^
6    |
7 note: lint level defined here
8   --> $DIR/float_cmp.rs:4:9
9    |
10 4  | #![deny(float_cmp)]
11    |         ^^^^^^^^^
12 help: consider comparing them within some error
13    |     (ONE - 1f32).abs() < error;
14 note: std::f32::EPSILON and std::f64::EPSILON are available.
15   --> $DIR/float_cmp.rs:43:5
16    |
17 43 |     ONE == 1f32;
18    |     ^^^^^^^^^^^
19
20 error: strict comparison of f32 or f64
21   --> $DIR/float_cmp.rs:47:5
22    |
23 47 |     ONE == 1.0 + 0.0;
24    |     ^^^^^^^^^^^^^^^^
25    |
26 help: consider comparing them within some error
27    |     (ONE - (1.0 + 0.0)).abs() < error;
28 note: std::f32::EPSILON and std::f64::EPSILON are available.
29   --> $DIR/float_cmp.rs:47:5
30    |
31 47 |     ONE == 1.0 + 0.0;
32    |     ^^^^^^^^^^^^^^^^
33
34 error: strict comparison of f32 or f64
35   --> $DIR/float_cmp.rs:52:5
36    |
37 52 |     ONE + ONE == ZERO + ONE + ONE;
38    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39    |
40 help: consider comparing them within some error
41    |     (ONE + ONE - (ZERO + ONE + ONE)).abs() < error;
42 note: std::f32::EPSILON and std::f64::EPSILON are available.
43   --> $DIR/float_cmp.rs:52:5
44    |
45 52 |     ONE + ONE == ZERO + ONE + ONE;
46    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
48 error: strict comparison of f32 or f64
49   --> $DIR/float_cmp.rs:57:5
50    |
51 57 |     ONE != 2.0;
52    |     ^^^^^^^^^^
53    |
54 help: consider comparing them within some error
55    |     (ONE - 2.0).abs() < error;
56 note: std::f32::EPSILON and std::f64::EPSILON are available.
57   --> $DIR/float_cmp.rs:57:5
58    |
59 57 |     ONE != 2.0;
60    |     ^^^^^^^^^^
61
62 error: strict comparison of f32 or f64
63   --> $DIR/float_cmp.rs:62:5
64    |
65 62 |     twice(ONE) != ONE;
66    |     ^^^^^^^^^^^^^^^^^
67    |
68 help: consider comparing them within some error
69    |     (twice(ONE) - ONE).abs() < error;
70 note: std::f32::EPSILON and std::f64::EPSILON are available.
71   --> $DIR/float_cmp.rs:62:5
72    |
73 62 |     twice(ONE) != ONE;
74    |     ^^^^^^^^^^^^^^^^^
75
76 error: strict comparison of f32 or f64
77   --> $DIR/float_cmp.rs:66:5
78    |
79 66 |     ONE as f64 != 2.0;
80    |     ^^^^^^^^^^^^^^^^^
81    |
82 help: consider comparing them within some error
83    |     (ONE as f64 - 2.0).abs() < error;
84 note: std::f32::EPSILON and std::f64::EPSILON are available.
85   --> $DIR/float_cmp.rs:66:5
86    |
87 66 |     ONE as f64 != 2.0;
88    |     ^^^^^^^^^^^^^^^^^
89
90 error: strict comparison of f32 or f64
91   --> $DIR/float_cmp.rs:74:5
92    |
93 74 |     x == 1.0;
94    |     ^^^^^^^^
95    |
96 help: consider comparing them within some error
97    |     (x - 1.0).abs() < error;
98 note: std::f32::EPSILON and std::f64::EPSILON are available.
99   --> $DIR/float_cmp.rs:74:5
100    |
101 74 |     x == 1.0;
102    |     ^^^^^^^^
103
104 error: strict comparison of f32 or f64
105   --> $DIR/float_cmp.rs:80:5
106    |
107 80 |     twice(x) != twice(ONE as f64);
108    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109    |
110 help: consider comparing them within some error
111    |     (twice(x) - twice(ONE as f64)).abs() < error;
112 note: std::f32::EPSILON and std::f64::EPSILON are available.
113   --> $DIR/float_cmp.rs:80:5
114    |
115 80 |     twice(x) != twice(ONE as f64);
116    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
118 error: aborting due to 8 previous errors
119