Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私のプログラムの整数変数であるxbaseの対数をCで計算する関数または他の方法はありますか?x
x
eC には、または以外の底の対数を計算する関数はありません10。
e
10
したがって、数学を使用してください:
logarithm of x base b = log(x)/log(b)
同じ底で対数を繰り返し計算する場合は、 を事前計算できます1/log(b)。コンパイラがこの最適化を実行できるとは限りません。
1/log(b)