2 #![warn(clippy::floating_point_improvements)]
5 const E: f32 = std::f32::consts::E;
11 let _ = x.log(std::f32::consts::E);
18 let _ = x.log(std::f64::consts::E);
23 let _ = (1.0 + x).ln();
24 let _ = (1.0 + x * 2.0).ln();
25 let _ = (1.0 + x.powi(2)).ln();
26 let _ = (1.0 + x.powi(2) * 2.0).ln();
27 let _ = (1.0 + (std::f32::consts::E - 1.0)).ln();
28 // Cases where the lint shouldn't be applied
29 let _ = (x + 1.0).ln();
30 let _ = (1.0 + x + 2.0).ln();
31 let _ = (1.0 + x - 2.0).ln();
34 let _ = (1.0 + x).ln();
35 let _ = (1.0 + x * 2.0).ln();
36 let _ = (1.0 + x.powi(2)).ln();
37 // Cases where the lint shouldn't be applied
38 let _ = (x + 1.0).ln();
39 let _ = (1.0 + x + 2.0).ln();
40 let _ = (1.0 + x - 2.0).ln();
46 let _ = std::f32::consts::E.powf(x);
47 let _ = x.powf(1.0 / 2.0);
48 let _ = x.powf(1.0 / 3.0);
52 let _ = std::f64::consts::E.powf(x);
53 let _ = x.powf(1.0 / 2.0);
54 let _ = x.powf(1.0 / 3.0);
59 let _ = x.exp() - 1.0;
60 let _ = x.exp() - 1.0 + 2.0;
61 // Cases where the lint shouldn't be applied
62 let _ = x.exp() - 2.0;
63 let _ = x.exp() - 1.0 * 2.0;
66 let _ = x.exp() - 1.0;
67 let _ = x.exp() - 1.0 + 2.0;
68 // Cases where the lint shouldn't be applied
69 let _ = x.exp() - 2.0;
70 let _ = x.exp() - 1.0 * 2.0;