Return Value 戻り値
The square root of the value. この値の平方根。
Availability
Technology
func squareRoot() -> Float80
The square root of the value. この値の平方根。
The following example declares a function that calculates the length of the hypotenuse of a right triangle given its two perpendicular sides. 以下の例はある関数を宣言します、それは、それの2つの直角側を与えられる直角三角形の斜辺の長さを計算します。
func hypotenuse(_ a: Double, _ b: Double) -> Double {
return (a * a + b * b).squareRoot()
}
let (dx, dy) = (3.0, 4.0)
let distance = hypotenuse(dx, dy)
// distance == 5.0
Note 注意
This documentation comment was inherited from Floating
.
この文書化コメントは、Floating
から引き継がれました。