Description
Summary
Like how rust defines constants with clearly more precision than needed,
For mathematical constants (that aren't already in fNN::consts
) it's nice to just paste in the full value with way more precision that you could ever need, like
let γ = 0.5772156649015328606065120900824024310421;
That's 40 decimal sigfigs, aka about 132 binary sigfigs, which is well more than is needed for any built-in float type (even f128
is only ≈33 decimal sigfigs).
And changing that to
let γ = 0.577_215_7;
as clippy suggests obfuscates more than it helps, plus it makes it harder if you change from f32
to f64
in the future.
For constants that have just slightly too much precision, especially things that look like integers, this lint makes sense.
But when the coder is clearly not thinking that it'll be exactly representable -- I'll toss that 40 sigfig threshold as a first stab at how clippy could know that -- then telling them that there's excess precision is not valuable, and clippy should let it go.
(Other things you could consider here are things like suppressing it for const
s defined with a type and a particularly-precise literal, or something.)
Lint Name
excessive_precision
Reproducer
No response
Version
Additional Labels
No response