我想在 Rust 中计算以下内容:
Python 等效项:
math.ceil(math.log(b+1, 2))
Run Code Online (Sandbox Code Playgroud)
我努力了:
a+1.log2()
(a+1).log2()
Run Code Online (Sandbox Code Playgroud)
但我得到了错误use of unstable library feature 'int_log'。我不想使用不稳定的库功能。如果可能的话,在没有任何外部板条箱的情况下计算 log2 最简单的方法是什么?
rust ×1