blob: e19f4980cd70d7be5713de8444d8ce8d72294f4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//@run-rustfix
#![warn(clippy::lossy_float_literal)]
#![allow(overflowing_literals, unused)]
fn main() {
// Lossy whole-number float literals
let _: f32 = 16_777_216.0;
let _: f32 = 16_777_220.0;
let _: f32 = 16_777_220.0;
let _: f32 = 16_777_220.0;
let _ = 16_777_220_f32;
let _: f32 = -16_777_220.0;
let _: f64 = 9_007_199_254_740_992.0;
let _: f64 = 9_007_199_254_740_992.0;
let _: f64 = 9_007_199_254_740_992.0;
let _ = 9_007_199_254_740_992_f64;
let _: f64 = -9_007_199_254_740_992.0;
// Lossless whole number float literals
let _: f32 = 16_777_216.0;
let _: f32 = 16_777_218.0;
let _: f32 = 16_777_220.0;
let _: f32 = -16_777_216.0;
let _: f32 = -16_777_220.0;
let _: f64 = 16_777_217.0;
let _: f64 = -16_777_217.0;
let _: f64 = 9_007_199_254_740_992.0;
let _: f64 = -9_007_199_254_740_992.0;
// Ignored whole number float literals
let _: f32 = 1e25;
let _: f32 = 1E25;
let _: f64 = 1e99;
let _: f64 = 1E99;
let _: f32 = 0.1;
const INF1: f32 = 1000000000000000000000000000000000f32;
const NEG_INF1: f32 = -340282357000000000000000000000000000001_f32;
}
|