RS.CLIPPY.LOSSY_FLOAT_LITERAL
Lossy whole number float literals
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: lossy_float_literal. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for whole number float literals that cannot be represented as the underlying type without loss.
Why restrict this?
If the value was intended to be exact, it will not be. This may be especially surprising when the lost precision is to the left of the decimal point.
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;