rust/tests/ui/floating_point_powf.rs

32 lines
837 B
Rust
Raw Normal View History

2020-02-17 14:56:55 -06:00
#![warn(clippy::suboptimal_flops)]
2019-12-20 19:57:47 -06:00
fn main() {
let x = 3f32;
let _ = 2f32.powf(x);
let _ = 2f32.powf(3.1);
let _ = 2f32.powf(-3.1);
2019-12-20 19:57:47 -06:00
let _ = std::f32::consts::E.powf(x);
let _ = std::f32::consts::E.powf(3.1);
let _ = std::f32::consts::E.powf(-3.1);
2019-12-20 19:57:47 -06:00
let _ = x.powf(1.0 / 2.0);
let _ = x.powf(1.0 / 3.0);
let _ = x.powf(2.0);
let _ = x.powf(-2.0);
let _ = x.powf(2.1);
let _ = x.powf(-2.1);
let x = 3f64;
let _ = 2f64.powf(x);
let _ = 2f64.powf(3.1);
let _ = 2f64.powf(-3.1);
2019-12-20 19:57:47 -06:00
let _ = std::f64::consts::E.powf(x);
let _ = std::f64::consts::E.powf(3.1);
let _ = std::f64::consts::E.powf(-3.1);
2019-12-20 19:57:47 -06:00
let _ = x.powf(1.0 / 2.0);
let _ = x.powf(1.0 / 3.0);
let _ = x.powf(2.0);
let _ = x.powf(-2.0);
let _ = x.powf(2.1);
let _ = x.powf(-2.1);
}