about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/floating_point_exp.fixed18
-rw-r--r--tests/ui/floating_point_exp.rs1
-rw-r--r--tests/ui/floating_point_exp.stderr8
-rw-r--r--tests/ui/floating_point_log.fixed58
-rw-r--r--tests/ui/floating_point_log.rs3
-rw-r--r--tests/ui/floating_point_log.stderr56
-rw-r--r--tests/ui/floating_point_powf.fixed40
-rw-r--r--tests/ui/floating_point_powf.rs9
-rw-r--r--tests/ui/floating_point_powf.stderr66
9 files changed, 205 insertions, 54 deletions
diff --git a/tests/ui/floating_point_exp.fixed b/tests/ui/floating_point_exp.fixed
new file mode 100644
index 00000000000..1f534e3705d
--- /dev/null
+++ b/tests/ui/floating_point_exp.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+#![warn(clippy::suboptimal_flops)]
+
+fn main() {
+    let x = 2f32;
+    let _ = x.exp_m1();
+    let _ = x.exp_m1() + 2.0;
+    // Cases where the lint shouldn't be applied
+    let _ = x.exp() - 2.0;
+    let _ = x.exp() - 1.0 * 2.0;
+
+    let x = 2f64;
+    let _ = x.exp_m1();
+    let _ = x.exp_m1() + 2.0;
+    // Cases where the lint shouldn't be applied
+    let _ = x.exp() - 2.0;
+    let _ = x.exp() - 1.0 * 2.0;
+}
diff --git a/tests/ui/floating_point_exp.rs b/tests/ui/floating_point_exp.rs
index c7fe0d03568..bed8d312140 100644
--- a/tests/ui/floating_point_exp.rs
+++ b/tests/ui/floating_point_exp.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 #![warn(clippy::suboptimal_flops)]
 
 fn main() {
diff --git a/tests/ui/floating_point_exp.stderr b/tests/ui/floating_point_exp.stderr
index 83adca8a46c..7882b2c24e3 100644
--- a/tests/ui/floating_point_exp.stderr
+++ b/tests/ui/floating_point_exp.stderr
@@ -1,5 +1,5 @@
 error: (e.pow(x) - 1) can be computed more accurately
-  --> $DIR/floating_point_exp.rs:5:13
+  --> $DIR/floating_point_exp.rs:6:13
    |
 LL |     let _ = x.exp() - 1.0;
    |             ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
@@ -7,19 +7,19 @@ LL |     let _ = x.exp() - 1.0;
    = note: `-D clippy::suboptimal-flops` implied by `-D warnings`
 
 error: (e.pow(x) - 1) can be computed more accurately
-  --> $DIR/floating_point_exp.rs:6:13
+  --> $DIR/floating_point_exp.rs:7:13
    |
 LL |     let _ = x.exp() - 1.0 + 2.0;
    |             ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
 
 error: (e.pow(x) - 1) can be computed more accurately
-  --> $DIR/floating_point_exp.rs:12:13
+  --> $DIR/floating_point_exp.rs:13:13
    |
 LL |     let _ = x.exp() - 1.0;
    |             ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
 
 error: (e.pow(x) - 1) can be computed more accurately
-  --> $DIR/floating_point_exp.rs:13:13
+  --> $DIR/floating_point_exp.rs:14:13
    |
 LL |     let _ = x.exp() - 1.0 + 2.0;
    |             ^^^^^^^^^^^^^ help: consider using: `x.exp_m1()`
diff --git a/tests/ui/floating_point_log.fixed b/tests/ui/floating_point_log.fixed
new file mode 100644
index 00000000000..ead45fc4a9f
--- /dev/null
+++ b/tests/ui/floating_point_log.fixed
@@ -0,0 +1,58 @@
+// run-rustfix
+#![allow(dead_code, clippy::double_parens)]
+#![warn(clippy::suboptimal_flops)]
+
+const TWO: f32 = 2.0;
+const E: f32 = std::f32::consts::E;
+
+fn check_log_base() {
+    let x = 1f32;
+    let _ = x.log2();
+    let _ = x.log10();
+    let _ = x.ln();
+    let _ = x.log2();
+    let _ = x.ln();
+
+    let x = 1f64;
+    let _ = x.log2();
+    let _ = x.log10();
+    let _ = x.ln();
+}
+
+fn check_ln1p() {
+    let x = 1f32;
+    let _ = 2.0f32.ln_1p();
+    let _ = 2.0f32.ln_1p();
+    let _ = x.ln_1p();
+    let _ = (x * 2.0).ln_1p();
+    let _ = x.powi(2).ln_1p();
+    let _ = (x.powi(2) * 2.0).ln_1p();
+    let _ = ((std::f32::consts::E - 1.0)).ln_1p();
+    let _ = x.ln_1p();
+    let _ = x.powi(2).ln_1p();
+    let _ = (x + 2.0).ln_1p();
+    let _ = (x * 2.0).ln_1p();
+    // Cases where the lint shouldn't be applied
+    let _ = (1.0 + x + 2.0).ln();
+    let _ = (x + 1.0 + 2.0).ln();
+    let _ = (x + 1.0 * 2.0).ln();
+    let _ = (1.0 + x - 2.0).ln();
+
+    let x = 1f64;
+    let _ = 2.0f64.ln_1p();
+    let _ = 2.0f64.ln_1p();
+    let _ = x.ln_1p();
+    let _ = (x * 2.0).ln_1p();
+    let _ = x.powi(2).ln_1p();
+    let _ = x.ln_1p();
+    let _ = x.powi(2).ln_1p();
+    let _ = (x + 2.0).ln_1p();
+    let _ = (x * 2.0).ln_1p();
+    // Cases where the lint shouldn't be applied
+    let _ = (1.0 + x + 2.0).ln();
+    let _ = (x + 1.0 + 2.0).ln();
+    let _ = (x + 1.0 * 2.0).ln();
+    let _ = (1.0 + x - 2.0).ln();
+}
+
+fn main() {}
diff --git a/tests/ui/floating_point_log.rs b/tests/ui/floating_point_log.rs
index c26f71f3067..f888e1375dc 100644
--- a/tests/ui/floating_point_log.rs
+++ b/tests/ui/floating_point_log.rs
@@ -1,4 +1,5 @@
-#![allow(dead_code)]
+// run-rustfix
+#![allow(dead_code, clippy::double_parens)]
 #![warn(clippy::suboptimal_flops)]
 
 const TWO: f32 = 2.0;
diff --git a/tests/ui/floating_point_log.stderr b/tests/ui/floating_point_log.stderr
index db2fc999b6c..c8c32b61ca3 100644
--- a/tests/ui/floating_point_log.stderr
+++ b/tests/ui/floating_point_log.stderr
@@ -1,5 +1,5 @@
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:9:13
+  --> $DIR/floating_point_log.rs:10:13
    |
 LL |     let _ = x.log(2f32);
    |             ^^^^^^^^^^^ help: consider using: `x.log2()`
@@ -7,163 +7,163 @@ LL |     let _ = x.log(2f32);
    = note: `-D clippy::suboptimal-flops` implied by `-D warnings`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:10:13
+  --> $DIR/floating_point_log.rs:11:13
    |
 LL |     let _ = x.log(10f32);
    |             ^^^^^^^^^^^^ help: consider using: `x.log10()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:11:13
+  --> $DIR/floating_point_log.rs:12:13
    |
 LL |     let _ = x.log(std::f32::consts::E);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:12:13
+  --> $DIR/floating_point_log.rs:13:13
    |
 LL |     let _ = x.log(TWO);
    |             ^^^^^^^^^^ help: consider using: `x.log2()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:13:13
+  --> $DIR/floating_point_log.rs:14:13
    |
 LL |     let _ = x.log(E);
    |             ^^^^^^^^ help: consider using: `x.ln()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:16:13
+  --> $DIR/floating_point_log.rs:17:13
    |
 LL |     let _ = x.log(2f64);
    |             ^^^^^^^^^^^ help: consider using: `x.log2()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:17:13
+  --> $DIR/floating_point_log.rs:18:13
    |
 LL |     let _ = x.log(10f64);
    |             ^^^^^^^^^^^^ help: consider using: `x.log10()`
 
 error: logarithm for bases 2, 10 and e can be computed more accurately
-  --> $DIR/floating_point_log.rs:18:13
+  --> $DIR/floating_point_log.rs:19:13
    |
 LL |     let _ = x.log(std::f64::consts::E);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.ln()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:23:13
+  --> $DIR/floating_point_log.rs:24:13
    |
 LL |     let _ = (1f32 + 2.).ln();
    |             ^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:24:13
+  --> $DIR/floating_point_log.rs:25:13
    |
 LL |     let _ = (1f32 + 2.0).ln();
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f32.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:25:13
+  --> $DIR/floating_point_log.rs:26:13
    |
 LL |     let _ = (1.0 + x).ln();
    |             ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:26:13
+  --> $DIR/floating_point_log.rs:27:13
    |
 LL |     let _ = (1.0 + x * 2.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x * 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:27:13
+  --> $DIR/floating_point_log.rs:28:13
    |
 LL |     let _ = (1.0 + x.powi(2)).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:28:13
+  --> $DIR/floating_point_log.rs:29:13
    |
 LL |     let _ = (1.0 + x.powi(2) * 2.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x.powi(2) * 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:29:13
+  --> $DIR/floating_point_log.rs:30:13
    |
 LL |     let _ = (1.0 + (std::f32::consts::E - 1.0)).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `((std::f32::consts::E - 1.0)).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:30:13
+  --> $DIR/floating_point_log.rs:31:13
    |
 LL |     let _ = (x + 1.0).ln();
    |             ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:31:13
+  --> $DIR/floating_point_log.rs:32:13
    |
 LL |     let _ = (x.powi(2) + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:32:13
+  --> $DIR/floating_point_log.rs:33:13
    |
 LL |     let _ = (x + 2.0 + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:33:13
+  --> $DIR/floating_point_log.rs:34:13
    |
 LL |     let _ = (x * 2.0 + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x * 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:41:13
+  --> $DIR/floating_point_log.rs:42:13
    |
 LL |     let _ = (1f64 + 2.).ln();
    |             ^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:42:13
+  --> $DIR/floating_point_log.rs:43:13
    |
 LL |     let _ = (1f64 + 2.0).ln();
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `2.0f64.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:43:13
+  --> $DIR/floating_point_log.rs:44:13
    |
 LL |     let _ = (1.0 + x).ln();
    |             ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:44:13
+  --> $DIR/floating_point_log.rs:45:13
    |
 LL |     let _ = (1.0 + x * 2.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x * 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:45:13
+  --> $DIR/floating_point_log.rs:46:13
    |
 LL |     let _ = (1.0 + x.powi(2)).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:46:13
+  --> $DIR/floating_point_log.rs:47:13
    |
 LL |     let _ = (x + 1.0).ln();
    |             ^^^^^^^^^^^^^^ help: consider using: `x.ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:47:13
+  --> $DIR/floating_point_log.rs:48:13
    |
 LL |     let _ = (x.powi(2) + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:48:13
+  --> $DIR/floating_point_log.rs:49:13
    |
 LL |     let _ = (x + 2.0 + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x + 2.0).ln_1p()`
 
 error: ln(1 + x) can be computed more accurately
-  --> $DIR/floating_point_log.rs:49:13
+  --> $DIR/floating_point_log.rs:50:13
    |
 LL |     let _ = (x * 2.0 + 1.0).ln();
    |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `(x * 2.0).ln_1p()`
diff --git a/tests/ui/floating_point_powf.fixed b/tests/ui/floating_point_powf.fixed
new file mode 100644
index 00000000000..54d130a22be
--- /dev/null
+++ b/tests/ui/floating_point_powf.fixed
@@ -0,0 +1,40 @@
+// run-rustfix
+#![warn(clippy::suboptimal_flops)]
+
+fn main() {
+    let x = 3f32;
+    let _ = x.exp2();
+    let _ = 3.1f32.exp2();
+    let _ = (-3.1f32).exp2();
+    let _ = x.exp();
+    let _ = 3.1f32.exp();
+    let _ = (-3.1f32).exp();
+    let _ = x.sqrt();
+    let _ = x.cbrt();
+    let _ = x.powi(2);
+    let _ = x.powi(-2);
+    let _ = x.powi(16_777_215);
+    let _ = x.powi(-16_777_215);
+    let _ = x.powf(2.1);
+    let _ = x.powf(-2.1);
+    let _ = x.powf(16_777_216.0);
+    let _ = x.powf(-16_777_216.0);
+
+    let x = 3f64;
+    let _ = x.exp2();
+    let _ = 3.1f64.exp2();
+    let _ = (-3.1f64).exp2();
+    let _ = x.exp();
+    let _ = 3.1f64.exp();
+    let _ = (-3.1f64).exp();
+    let _ = x.sqrt();
+    let _ = x.cbrt();
+    let _ = x.powi(2);
+    let _ = x.powi(-2);
+    let _ = x.powi(-2_147_483_648);
+    let _ = x.powi(2_147_483_647);
+    let _ = x.powf(2.1);
+    let _ = x.powf(-2.1);
+    let _ = x.powf(-2_147_483_649.0);
+    let _ = x.powf(2_147_483_648.0);
+}
diff --git a/tests/ui/floating_point_powf.rs b/tests/ui/floating_point_powf.rs
index 2076821b5b0..c1b64d704cd 100644
--- a/tests/ui/floating_point_powf.rs
+++ b/tests/ui/floating_point_powf.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 #![warn(clippy::suboptimal_flops)]
 
 fn main() {
@@ -12,8 +13,12 @@ fn main() {
     let _ = x.powf(1.0 / 3.0);
     let _ = x.powf(2.0);
     let _ = x.powf(-2.0);
+    let _ = x.powf(16_777_215.0);
+    let _ = x.powf(-16_777_215.0);
     let _ = x.powf(2.1);
     let _ = x.powf(-2.1);
+    let _ = x.powf(16_777_216.0);
+    let _ = x.powf(-16_777_216.0);
 
     let x = 3f64;
     let _ = 2f64.powf(x);
@@ -26,6 +31,10 @@ fn main() {
     let _ = x.powf(1.0 / 3.0);
     let _ = x.powf(2.0);
     let _ = x.powf(-2.0);
+    let _ = x.powf(-2_147_483_648.0);
+    let _ = x.powf(2_147_483_647.0);
     let _ = x.powf(2.1);
     let _ = x.powf(-2.1);
+    let _ = x.powf(-2_147_483_649.0);
+    let _ = x.powf(2_147_483_648.0);
 }
diff --git a/tests/ui/floating_point_powf.stderr b/tests/ui/floating_point_powf.stderr
index 35e0c5e56fd..2b912c5940e 100644
--- a/tests/ui/floating_point_powf.stderr
+++ b/tests/ui/floating_point_powf.stderr
@@ -1,5 +1,5 @@
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:5:13
+  --> $DIR/floating_point_powf.rs:6:13
    |
 LL |     let _ = 2f32.powf(x);
    |             ^^^^^^^^^^^^ help: consider using: `x.exp2()`
@@ -7,118 +7,142 @@ LL |     let _ = 2f32.powf(x);
    = note: `-D clippy::suboptimal-flops` implied by `-D warnings`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:6:13
+  --> $DIR/floating_point_powf.rs:7:13
    |
 LL |     let _ = 2f32.powf(3.1);
    |             ^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp2()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:7:13
+  --> $DIR/floating_point_powf.rs:8:13
    |
 LL |     let _ = 2f32.powf(-3.1);
    |             ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp2()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:8:13
+  --> $DIR/floating_point_powf.rs:9:13
    |
 LL |     let _ = std::f32::consts::E.powf(x);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:9:13
+  --> $DIR/floating_point_powf.rs:10:13
    |
 LL |     let _ = std::f32::consts::E.powf(3.1);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f32.exp()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:10:13
+  --> $DIR/floating_point_powf.rs:11:13
    |
 LL |     let _ = std::f32::consts::E.powf(-3.1);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f32).exp()`
 
 error: square-root of a number can be computed more efficiently and accurately
-  --> $DIR/floating_point_powf.rs:11:13
+  --> $DIR/floating_point_powf.rs:12:13
    |
 LL |     let _ = x.powf(1.0 / 2.0);
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
 
 error: cube-root of a number can be computed more accurately
-  --> $DIR/floating_point_powf.rs:12:13
+  --> $DIR/floating_point_powf.rs:13:13
    |
 LL |     let _ = x.powf(1.0 / 3.0);
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
 
 error: exponentiation with integer powers can be computed more efficiently
-  --> $DIR/floating_point_powf.rs:13:13
+  --> $DIR/floating_point_powf.rs:14:13
    |
 LL |     let _ = x.powf(2.0);
    |             ^^^^^^^^^^^ help: consider using: `x.powi(2)`
 
 error: exponentiation with integer powers can be computed more efficiently
-  --> $DIR/floating_point_powf.rs:14:13
+  --> $DIR/floating_point_powf.rs:15:13
    |
 LL |     let _ = x.powf(-2.0);
    |             ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
 
+error: exponentiation with integer powers can be computed more efficiently
+  --> $DIR/floating_point_powf.rs:16:13
+   |
+LL |     let _ = x.powf(16_777_215.0);
+   |             ^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(16_777_215)`
+
+error: exponentiation with integer powers can be computed more efficiently
+  --> $DIR/floating_point_powf.rs:17:13
+   |
+LL |     let _ = x.powf(-16_777_215.0);
+   |             ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-16_777_215)`
+
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:19:13
+  --> $DIR/floating_point_powf.rs:24:13
    |
 LL |     let _ = 2f64.powf(x);
    |             ^^^^^^^^^^^^ help: consider using: `x.exp2()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:20:13
+  --> $DIR/floating_point_powf.rs:25:13
    |
 LL |     let _ = 2f64.powf(3.1);
    |             ^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp2()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:21:13
+  --> $DIR/floating_point_powf.rs:26:13
    |
 LL |     let _ = 2f64.powf(-3.1);
    |             ^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp2()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:22:13
+  --> $DIR/floating_point_powf.rs:27:13
    |
 LL |     let _ = std::f64::consts::E.powf(x);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.exp()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:23:13
+  --> $DIR/floating_point_powf.rs:28:13
    |
 LL |     let _ = std::f64::consts::E.powf(3.1);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `3.1f64.exp()`
 
 error: exponent for bases 2 and e can be computed more accurately
-  --> $DIR/floating_point_powf.rs:24:13
+  --> $DIR/floating_point_powf.rs:29:13
    |
 LL |     let _ = std::f64::consts::E.powf(-3.1);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-3.1f64).exp()`
 
 error: square-root of a number can be computed more efficiently and accurately
-  --> $DIR/floating_point_powf.rs:25:13
+  --> $DIR/floating_point_powf.rs:30:13
    |
 LL |     let _ = x.powf(1.0 / 2.0);
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `x.sqrt()`
 
 error: cube-root of a number can be computed more accurately
-  --> $DIR/floating_point_powf.rs:26:13
+  --> $DIR/floating_point_powf.rs:31:13
    |
 LL |     let _ = x.powf(1.0 / 3.0);
    |             ^^^^^^^^^^^^^^^^^ help: consider using: `x.cbrt()`
 
 error: exponentiation with integer powers can be computed more efficiently
-  --> $DIR/floating_point_powf.rs:27:13
+  --> $DIR/floating_point_powf.rs:32:13
    |
 LL |     let _ = x.powf(2.0);
    |             ^^^^^^^^^^^ help: consider using: `x.powi(2)`
 
 error: exponentiation with integer powers can be computed more efficiently
-  --> $DIR/floating_point_powf.rs:28:13
+  --> $DIR/floating_point_powf.rs:33:13
    |
 LL |     let _ = x.powf(-2.0);
    |             ^^^^^^^^^^^^ help: consider using: `x.powi(-2)`
 
-error: aborting due to 20 previous errors
+error: exponentiation with integer powers can be computed more efficiently
+  --> $DIR/floating_point_powf.rs:34:13
+   |
+LL |     let _ = x.powf(-2_147_483_648.0);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(-2_147_483_648)`
+
+error: exponentiation with integer powers can be computed more efficiently
+  --> $DIR/floating_point_powf.rs:35:13
+   |
+LL |     let _ = x.powf(2_147_483_647.0);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `x.powi(2_147_483_647)`
+
+error: aborting due to 24 previous errors