Parameter | Description |
---|---|
f | Real number whose square root to calculate. |
float
Real number whose square is f
.
Returns square root of f
(real number whose square equals f
).
When used with negative values, the output will be equal to NaN.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { // The formula made famous by Pythagoras, also used internally by // Vector3.Distance and several other standard functions. float HypotenuseLength(float sideALength, float sideBLength) { return Mathf.Sqrt(sideALength * sideALength + sideBLength * sideBLength); } }