SQRT Function

Calculates the square root of an expression.

Syntax

SQRT(expression)

Syntax Elements

expression is any DataBasic expression that evaluates to a numeric value greater than or equal to zero.

If expression evaluates to a negative number, SQRT returns zero and a warning message is displayed.

Operation

If there is no PRECISION statement in the program, the value is returned rounded to the nearest four decimal places. Otherwise, the number of decimal places returned is as specified by the PRECISION statement.

In each case, the significant decimal places returned are the result of rounding. However, only up to five places are significant: if the PRECISION statement specifies a precision greater than five, trailing zeroes are appended to the five significant places so as to return the numbers of places specified.

Examples

X = "64"
Y = SQRT(X)

Assigns the value 8 (the square root of 64) to variable Y.

C = SQRT(A*A + B*B)

Finds the hypotenuse of a right-angled triangle and assigns the value to variable C.