2 #![feature(const_fn_floating_point_arithmetic)]
3 #![warn(clippy::suboptimal_flops)]
5 /// Allow suboptimal_ops in constant context
6 pub const fn in_const_context() {
16 let a: f64 = 1234.567;
17 let b: f64 = 45.67834;
23 let _ = a + 2.0 * 4.0;
28 let _ = a * b * c + d;
30 let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
31 let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
33 let _ = (a * a + b).sqrt();
35 // Cases where the lint shouldn't be applied
36 let _ = (a * a + b * b).sqrt();