Closed wg21bot closed 4 years ago
Removed SG6 tag
LEWG in Belfast: Forward P1956 with names selected by LEWG (paper being revised by Vincent and wording added) to LWG for C++20.
LWG Tuesday afternoon in Prague -- accept 1956 for c++20.
LWG in Prague: Accepted with modification. See paper P1956R1.
The name of std::log2p1 clashes with an IEEE-754 algorithm of the same name, which has been included in a C TS meant for inclusion in a future C standard (and probably also in C++). There is no ambiguity between the overloads, however having a name overloaded for two completely different mathematical formulas is not a good thing. For reference, the log2p1 algorithm from the CD is
log2p1(x) = (x == 0) ? 0 : 1 + floor(log2(x))
, while the log2p1 algorithm from IEEE-754log2p1(x) = log2(1 + x)
. Additionally, the function the CD calls log2p1 is commonly - at the very least in Python, Ruby, Java, and Dart - calledbit_length
. To the author of this comment, it seems preferable to follow the name that is used in other languages, to make it easier for programmers to communicate and reason about code across the different languages.Proposed change: Rename
std::log2p1
tostd::bit_length
.