sqrt
Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0)) // 3.0
println(sqrt(5.76)) // 2.4
// special cases
println(sqrt(-0.0)) // -0.0
println(sqrt(-4.0)) // NaN
println(sqrt(Double.NaN)) // NaN
println(sqrt(Double.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}Computes the positive square root of the value x.
Special cases:
sqrt(NaN)isNaNsqrt(-0.0)is-0.0sqrt(x)isNaNwhenx < 0
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
println(sqrt(9.0f)) // 3.0
println(sqrt(5.76f)) // 2.4
// special cases
println(sqrt(-0.0f)) // -0.0
println(sqrt(-4.0f)) // NaN
println(sqrt(Float.NaN)) // NaN
println(sqrt(Float.POSITIVE_INFINITY)) // Infinity
//sampleEnd
}