log
Platform and version requirements: JVM (1.2), JS (1.2), Native (1.2)
fun log(x: Double, base: Double): Double
fun log(x: Float, base: Float): Float
Computes the logarithm of the value x to the given base.
Special cases:
-
log(x, b)isNaNif eitherxorbareNaN -
log(x, b)isNaNwhenx < 0orb <= 0orb == 1.0 -
log(+Inf, +Inf)isNaN -
log(+Inf, b)is+Infforb > 1and-Infforb < 1 -
log(0.0, b)is-Infforb > 1and+Infforb > 1
See also logarithm functions for common fixed bases: ln, log10 and log2.
© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/log.html