Built-in functions: math_sqrt()

The function math_sqrt() calculates a square root expression.

Declaration

float math_sqrt( float aValue )

Parameters

aValue

The value to calculate the square root.

Discussion

The function math_sqrt() calculates the square root of the value passed in the parameter aValue. For example, it is used for vector length calculation:

var float vecX = 10.5 var float vecY = 4.6; var float len = math_sqrt( vecX * vecX + vecY * vecY ); // len = 11.4634...

Passing a negative value as parameter causes the function to return a non-a-number value.