mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 08:44:16 -05:00
Merge pull request #789 from kolbma/exercise-clippy1-hint-390
chore: clippy1 hint enhancement
This commit is contained in:
commit
123e6426d1
1 changed files with 9 additions and 1 deletions
10
info.toml
10
info.toml
|
@ -902,7 +902,15 @@ name = "clippy1"
|
||||||
path = "exercises/clippy/clippy1.rs"
|
path = "exercises/clippy/clippy1.rs"
|
||||||
mode = "clippy"
|
mode = "clippy"
|
||||||
hint = """
|
hint = """
|
||||||
Floating point calculations are usually imprecise, so asking if two values are exactly equal is asking for trouble"""
|
Not every floating point value can be represented exactly in binary values in
|
||||||
|
memory. Take a look at the description of
|
||||||
|
https://doc.rust-lang.org/stable/std/primitive.f32.html
|
||||||
|
When using the binary compare operators with floating points you won't compare
|
||||||
|
the floating point values but the binary representation in memory. This is
|
||||||
|
usually not what you would like to do.
|
||||||
|
See the suggestions of the clippy warning in compile output and use the
|
||||||
|
machine epsilon value...
|
||||||
|
https://doc.rust-lang.org/stable/std/primitive.f32.html#associatedconstant.EPSILON"""
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
name = "clippy2"
|
name = "clippy2"
|
||||||
|
|
Loading…
Reference in a new issue