1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:19:13
|
LL | let _ = a * b + c;
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
|
= note: `-D clippy::suboptimal-flops` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::suboptimal_flops)]`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:21:13
|
LL | let _ = a * b - c;
| ^^^^^^^^^ help: consider using: `a.mul_add(b, -c)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:23:13
|
LL | let _ = c + a * b;
| ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:25:13
|
LL | let _ = c - a * b;
| ^^^^^^^^^ help: consider using: `a.mul_add(-b, c)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:27:13
|
LL | let _ = a + 2.0 * 4.0;
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:29:13
|
LL | let _ = a + 2. * 4.;
| ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:32:13
|
LL | let _ = (a * b) + c;
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:34:13
|
LL | let _ = c + (a * b);
| ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:36:13
|
LL | let _ = a * b * c + d;
| ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:39:13
|
LL | let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:41:13
|
LL | let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:44:13
|
LL | let _ = (a * a + b).sqrt();
| ^^^^^^^^^^^ help: consider using: `a.mul_add(a, b)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:48:13
|
LL | let _ = a - (b * u as f64);
| ^^^^^^^^^^^^^^^^^^ help: consider using: `b.mul_add(-(u as f64), a)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:102:13
|
LL | let _ = 0.5 + 2.0 * x;
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(x, 0.5)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:104:13
|
LL | let _ = 2.0 * x + 0.5;
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(x, 0.5)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:107:13
|
LL | let _ = x + 2.0 * 4.0;
| ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, x)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:111:13
|
LL | let _ = y * 2.0 + 0.5;
| ^^^^^^^^^^^^^ help: consider using: `y.mul_add(2.0, 0.5)`
error: multiply and add expressions can be calculated more efficiently and accurately
--> tests/ui/floating_point_mul_add.rs:113:13
|
LL | let _ = 1.0 * 2.0 + 0.5;
| ^^^^^^^^^^^^^^^ help: consider using: `1.0f64.mul_add(2.0, 0.5)`
error: aborting due to 18 previous errors
|