|
Author:
{'email': 'justin.seyster@mongodb.com', 'name': 'Justin Seyster', 'username': 'jseyster'}
Message: SERVER-38623 Make safeNumberLongForHash consistent on all platforms
Previously, the hash function for double values relied on undefined
behavior when computing the hash for 2^63, meaning that it could give
different results on different platforms. Almost all platforms we
support returned -2^63 as the result of safeNumberLongForHash when the
input was 2^63, so this patch makes that the official result. Now,
safeNumberLongForHash will explicitly convert 2^63 to -2^63 on all
platforms without invoking any undefined behavior.
Note that this does not change our guidance that using a hashed index
for a field containing a floating point value greater than 2^53 is
unsupported:
https://docs.mongodb.com/manual/core/index-hashed/#considerations
Branch: master
https://github.com/mongodb/mongo/commit/f2ab9fa71aabf110b67c28131241de6a27a3f09e
|