log10

expect fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

expect fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}
actual inline fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

actual inline fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}
actual inline fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

actual inline fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.2

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}
actual external fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.3

See also

actual function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

actual external fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.3

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}
actual fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.8

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

actual fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.8

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}
actual fun log10(x: Double): Double(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.8

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0)) // 1.0
println(log10(1.0)) // 0.0
println(log10(1000.0)) // 3.0

// Special cases
println(log10(Double.NaN)) // NaN
println(log10(-1.0)) // NaN
println(log10(0.0)) // -Infinity
println(log10(Double.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}

actual fun log10(x: Float): Float(source)

Computes the common logarithm (base 10) of the value x.

Since Kotlin

1.8

See also

function for special cases.

Samples

import kotlin.math.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   println(log10(10.0f)) // 1.0
println(log10(1.0f)) // 0.0
println(log10(1000.0f)) // 3.0

// Special cases
println(log10(Float.NaN)) // NaN
println(log10(-1.0f)) // NaN
println(log10(0.0f)) // -Infinity
println(log10(Float.POSITIVE_INFINITY)) // Infinity 
   //sampleEnd
}