logoalt Hacker News

ape4today at 3:59 AM1 replyview on HN

Perhaps nicer to avoid the comment and write:

    const C1 = 505054698555331      // floor(2^64*4/146097)
as

    constexpr int C1 = floor(2^64*4/146097);

Replies

aw1621107today at 5:43 AM

std::floor was made constexpr in C++23, which is pretty recent as far as C++ standards go. It's possible the author didn't think using C++23 was worth the constraints it places on who could use the code.

show 1 reply