Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mathf.Sqrt

Switch to Manual
public static function Sqrt(f: float): float;

Parameters

Description

Returns square root of f.

// The formula made famous by Pythagoras, also used internally by
// Vector3.Distance and several other standard functions.
function HypotenuseLength(sideALength: float, sideBLength: float) {
	return Mathf.Sqrt(sideALength * sideALength + sideBLength * sideBLength);
}