]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/floating_point_mul_add.rs
Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24a96cd369'
[rust.git] / src / tools / clippy / tests / ui / floating_point_mul_add.rs
1 // run-rustfix
2 #![warn(clippy::suboptimal_flops)]
3
4 fn main() {
5     let a: f64 = 1234.567;
6     let b: f64 = 45.67834;
7     let c: f64 = 0.0004;
8     let d: f64 = 0.0001;
9
10     let _ = a * b + c;
11     let _ = c + a * b;
12     let _ = a + 2.0 * 4.0;
13     let _ = a + 2. * 4.;
14
15     let _ = (a * b) + c;
16     let _ = c + (a * b);
17     let _ = a * b * c + d;
18
19     let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
20     let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
21 }