]> git.lizzy.rs Git - rust.git/blob - tests/ui/approx_const.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / approx_const.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #[warn(clippy::approx_constant)]
11 #[allow(unused, clippy::shadow_unrelated, clippy::similar_names, clippy::unreadable_literal)]
12 fn main() {
13     let my_e = 2.7182;
14     let almost_e = 2.718;
15     let no_e = 2.71;
16
17     let my_1_frac_pi = 0.3183;
18     let no_1_frac_pi = 0.31;
19
20     let my_frac_1_sqrt_2 = 0.70710678;
21     let almost_frac_1_sqrt_2 = 0.70711;
22     let my_frac_1_sqrt_2 = 0.707;
23
24     let my_frac_2_pi = 0.63661977;
25     let no_frac_2_pi = 0.636;
26
27     let my_frac_2_sq_pi = 1.128379;
28     let no_frac_2_sq_pi = 1.128;
29
30     let my_frac_pi_2 = 1.57079632679;
31     let no_frac_pi_2 = 1.5705;
32
33     let my_frac_pi_3 = 1.04719755119;
34     let no_frac_pi_3 = 1.047;
35
36     let my_frac_pi_4 = 0.785398163397;
37     let no_frac_pi_4 = 0.785;
38
39     let my_frac_pi_6 = 0.523598775598;
40     let no_frac_pi_6 = 0.523;
41
42     let my_frac_pi_8 = 0.3926990816987;
43     let no_frac_pi_8 = 0.392;
44
45     let my_ln_10 = 2.302585092994046;
46     let no_ln_10 = 2.303;
47
48     let my_ln_2 = 0.6931471805599453;
49     let no_ln_2 = 0.693;
50
51     let my_log10_e = 0.4342944819032518;
52     let no_log10_e = 0.434;
53
54     let my_log2_e = 1.4426950408889634;
55     let no_log2_e = 1.442;
56
57     let my_pi = 3.1415;
58     let almost_pi = 3.14;
59     let no_pi = 3.15;
60
61     let my_sq2 = 1.4142;
62     let no_sq2 = 1.414;
63 }