summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/lossy_float_literal.txt
blob: bbcb9115ea62a2f7ab2b608d1b56c48edc86cb48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### What it does
Checks for whole number float literals that
cannot be represented as the underlying type without loss.

### Why is this bad?
Rust will silently lose precision during
conversion to a float.

### Example
```
let _: f32 = 16_777_217.0; // 16_777_216.0
```

Use instead:
```
let _: f32 = 16_777_216.0;
let _: f64 = 16_777_217.0;
```