SQRT Function

The SQRT function returns the square root of an expression, given that the expression evaluates to a positive number.

Format

SQRT(expr)

Parameter(s)

expr

An expression evaluating to a numeric value.

Description

The SQRT function returns the square root of expr. If the expr evaluates to a negative value, the SQRT function returns a value of 0.

Example

This example demonstrates how the SQRT function may be used to calculate the diagonal of a given rectangle:

DIAGONAL = SQRT(HEIGHT * HEIGHT + WIDTH * WIDTH)

PRINT "THE DIAGONAL OF THE RECTANGLE IS " : DIAGONAL : "."

See Also

Statement and Function Reference