Skip to content

Commit 123e642

Browse files
authored
Merge pull request #789 from kolbma/exercise-clippy1-hint-390
chore: clippy1 hint enhancement
2 parents 427ec6b + 9bf4c5e commit 123e642

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

info.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,15 @@ name = "clippy1"
902902
path = "exercises/clippy/clippy1.rs"
903903
mode = "clippy"
904904
hint = """
905-
Floating point calculations are usually imprecise, so asking if two values are exactly equal is asking for trouble"""
905+
Not every floating point value can be represented exactly in binary values in
906+
memory. Take a look at the description of
907+
https://doc.rust-lang.org/stable/std/primitive.f32.html
908+
When using the binary compare operators with floating points you won't compare
909+
the floating point values but the binary representation in memory. This is
910+
usually not what you would like to do.
911+
See the suggestions of the clippy warning in compile output and use the
912+
machine epsilon value...
913+
https://doc.rust-lang.org/stable/std/primitive.f32.html#associatedconstant.EPSILON"""
906914

907915
[[exercises]]
908916
name = "clippy2"

0 commit comments

Comments
 (0)