Caché MultiValue Basic Reference
SQRT


Returns the square root of a number.
Synopsis
Arguments
Description
The
SQRT function returns the square root of
number. This numeric value can be expressed as either a number or as a string. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a nonnumeric character is encountered. Thus “7dwarves” is parsed as 7. Nonnumeric strings and null strings are parsed as 0. The square root of 0 is 0.
You cannot return the square root of a negative number. Attempted to do so results in an <ILLEGAL VALUE> error.
Examples
The following example uses the
SQRT function to calculate the square roots of the integers 0 through 16:
FOR x = 0 TO 16
PRINT "Square root of ":x:" = ":Sqrt(x)
NEXT
The following example uses the
SQRT function to calculate the square root of pi:
pi = 4 * ATAN(1)
PRINT "Square root of pi = ":SQRT(pi)
See Also