]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/lossy_float_literal.txt
Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup
[rust.git] / src / tools / clippy / src / docs / lossy_float_literal.txt
1 ### What it does
2 Checks for whole number float literals that
3 cannot be represented as the underlying type without loss.
4
5 ### Why is this bad?
6 Rust will silently lose precision during
7 conversion to a float.
8
9 ### Example
10 ```
11 let _: f32 = 16_777_217.0; // 16_777_216.0
12 ```
13
14 Use instead:
15 ```
16 let _: f32 = 16_777_216.0;
17 let _: f64 = 16_777_217.0;
18 ```