cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

PL326 26.05 [bit] Rename log2p1 to bit_length P1956 #322

Closed wg21bot closed 4 years ago

wg21bot commented 5 years ago

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-754 log2p1(x) = log2(1 + x). Additionally, the function the CD calls log2p1 is commonly - at the very least in Python, Ruby, Java, and Dart - called bit_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 to std::bit_length.

Cpp-Lisa commented 5 years ago

Removed SG6 tag

tituswinters commented 5 years ago

LEWG in Belfast: Forward P1956 with names selected by LEWG (paper being revised by Vincent and wording added) to LWG for C++20.

mclow commented 4 years ago

P1956R0 was in the pre-Prague mailing, but needs some revisions.

JeffGarland commented 4 years ago

LWG Tuesday afternoon in Prague -- accept 1956 for c++20.

jensmaurer commented 4 years ago

LWG in Prague: Accepted with modification. See paper P1956R1.