summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarlecchino <kolbma@users.noreply.github.com>2021-06-29 20:47:32 +0200
committerGitHub <noreply@github.com>2021-06-29 20:47:32 +0200
commit9bf4c5e8df576e36a1a2e9d022dae6b7d5e5f4f8 (patch)
tree2034e27c3681685286dcf5ec867f378fced23193
parent633303d4b8163e349c118c6cbd216185efe2ba24 (diff)
chore: clippy1 hint enhancement
Added some explanation and links about floating point representation and to use the clippy suggestion. (fixes #390)
-rw-r--r--info.toml10
1 files changed, 9 insertions, 1 deletions
diff --git a/info.toml b/info.toml
index e91909a..afc7fdf 100644
--- a/info.toml
+++ b/info.toml
@@ -902,7 +902,15 @@ name = "clippy1"
path = "exercises/clippy/clippy1.rs"
mode = "clippy"
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]]
name = "clippy2"