Caché MultiValue Basic Reference
SQRT
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the square root of a number.
Synopsis
SQRT(number)
Arguments
number An expression that resolves to a positive number or numeric string.
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 non-numeric character is encountered. Thus “7dwarves” is parsed as 7. Non-numeric 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