64-bit Integer and 64-bit Float: Who Has More Values?
1 answer
In 64-bit, an integer (2 ^ 64 for a two-piece machine) has more unique values.
However, 64-bit float has a much wider range of values.
This can be trivially argued because a 64-bit integer has a unique bit pattern for each unique value (it's "100% efficient"), while a 64-bit float has a dedicated sign bit (which allows - 0, but - 0 == 0 is true ), as well as a few "special patterns" (like one NaN
that has multiple representations ), thereby reducing the total number of unique values ββthat a float can represent.
See the IEEE-754 article on Wikipedia and see the Non-Number Representation sections
+7
user166390
source
to share