log_b(x) = ln(x) / ln(b)
Compute the logarithm of a value in any base, including natural and common logs.
📐 計算公式
對數換底(本頁程式碼口徑):log_b(x)=ln(x)÷ln(b),分母用 Math.log1p(b−1) 穩定計算接近 1 的底數;聯動量:自然對數 ln(x) 與 ln(b)。校驗:x、b 必填且有限;真數 x>0;底數 b>0 且 b 不能恰等於 1(接近 1 的合法底數如 1.0000000000005 可正常計算,僅提示浮點精度限制),違反即報錯並中止。判據:無固定分級,b=e 時結果即自然對數、b=10 時即常用對數,主結果保留 6 位小數;輔助表複用同一校驗。
換底公式求任意底數的對數。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Change-of-base formula | log_a(b) = ln(b) / ln(a) | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Definition | a^y = b is equivalent to y = log_a(b), with a > 0, a ≠ 1, b > 0 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Notation for common bases | lg = log10, ln = log_e, lb = log2 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Reciprocal identity | log_a(b) · log_b(a) = 1 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
📌 計算說明
- log_10(1000)=3。
- 換底公式:ln x/ln b。