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。