Sqrt

From AutoIt Wiki

Jump to: navigation, search

Calculates the square-root of a number. Adapted from AutoIt docs.
To calculate an nth root, use the power operator: x ^(1/n)

Contents

Syntax

$x = Sqrt(expr)

Parameters

exprAny non-negative expression to calculate.

Return Value

Success: Returns the square-root.
Failure: Returns 0 and sets @error to 1 if parameter is negative.

Example

$x = Sqrt(2)  ;returns 1.4142135623731
$y = sqrt(9)  ;returns 3

Related Functions

Exp Log