File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -902,7 +902,15 @@ name = "clippy1"
902
902
path = " exercises/clippy/clippy1.rs"
903
903
mode = " clippy"
904
904
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"""
906
914
907
915
[[exercises ]]
908
916
name = " clippy2"
You can’t perform that action at this time.
0 commit comments