hypot

Computes sqrt(x^2 + y^2) without intermediate overflow or underflow.

expect fun hypot(x: Double, y: Double): Double(source)
import kotlin.math.hypot

fun main() {
    val x = 3.0
    val y = 4.0
    val distance = hypot(x, y)
    println("The distance is $distance") // outputs 5.0
}

Source