pow
Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2.0)) // 4.0
println(3.0.pow(1.0)) // 3.0
println(4.0.pow(0.0)) // 1.0
println(2.0.pow(-2.0)) // 0.25
println(4.0.pow(0.5)) // 2.0
println((-2.0).pow(2.0)) // 4.0
// special cases
println(Double.NaN.pow(42.0)) // NaN
println(Double.NaN.pow(0.0)) // 1.0
println(3.0.pow(Double.NaN)) // NaN
println((-2.0).pow(0.75)) // NaN
println(1.0.pow(Double.POSITIVE_INFINITY)) // NaN
println(1.0.pow(Double.NEGATIVE_INFINITY)) // NaN
println(2.0.pow(Double.POSITIVE_INFINITY)) // Infinity
println(2.0.pow(Double.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0.pow(2)) // 4.0
println(3.0.pow(1)) // 3.0
println(4.0.pow(0)) // 1.0
println(2.0.pow(-2)) // 0.25
println((-2.0).pow(2)) // 4.0
// special cases
println(Double.NaN.pow(42)) // NaN
println(Double.NaN.pow(0)) // 1.0
//sampleEnd
}Raises this value to the power x.
Special cases:
b.pow(0.0)is1.0b.pow(1.0) == bb.pow(NaN)isNaNNaN.pow(x)isNaNforx != 0.0b.pow(Inf)isNaNforabs(b) == 1.0b.pow(x)isNaNforb < 0andxis finite and not an integer
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2.0f)) // 4.0
println(3.0f.pow(1.0f)) // 3.0
println(4.0f.pow(0.0f)) // 1.0
println(2.0f.pow(-2.0f)) // 0.25
println(4.0f.pow(0.5f)) // 2.0
println((-2.0f).pow(2.0f)) // 4.0
// special cases
println(Float.NaN.pow(42.0f)) // NaN
println(Float.NaN.pow(0.0f)) // 1.0
println(3.0f.pow(Float.NaN)) // NaN
println((-2.0f).pow(0.75f)) // NaN
println(1.0f.pow(Float.POSITIVE_INFINITY)) // NaN
println(1.0f.pow(Float.NEGATIVE_INFINITY)) // NaN
println(2.0f.pow(Float.POSITIVE_INFINITY)) // Infinity
println(2.0f.pow(Float.NEGATIVE_INFINITY)) // 0.0
//sampleEnd
}Raises this value to the integer power n.
See the other overload of pow for details.
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(2.0f.pow(2)) // 4.0
println(3.0f.pow(1)) // 3.0
println(4.0f.pow(0)) // 1.0
println(2.0f.pow(-2)) // 0.25
println((-2.0f).pow(2)) // 4.0
// special cases
println(Float.NaN.pow(42)) // NaN
println(Float.NaN.pow(0)) // 1.0
//sampleEnd
}